Asp.Net操作txt,读写取。并对txt文件进行条件查询
1)创建txt文件【web.config】
--------------------------------------------------------------------
<appSettings>
<add key="EditChars" value="D:\Site\ZJPS\TextFile\EditChars.txt"/>
</appSettings>
2) 页面的CS文件中:
--------------------------------------------------------------------
【1】 获取txt文件位置: protected string FileName = System.Configuration.ConfigurationManager.AppSettings["EditChars"].ToString();
【2】 文件操作:创建、写、读 文件。
#region 文件操作
/// <summary>
/// 创建txt文件
/// </summary>
public void CreateToFile()
{
StreamWriter SW;
SW = File.CreateText(FileName);
SW.Close();
}
/// <summary>
/// 写文件
/// </summary>
public void WriteToFile()
{
string InsertStr = "";
if (!File.Exists(FileName))
{
CreateToFile();
InsertStr = "Content#Date
相关文档:
分页这个也是最多人问的,也是很基础很实用的。
网上有很多分页代码,要不是有前台就没后台,要不是有后台没前台,要不是就是控件,要不就是一大堆SQL代码,让人不知道怎样用。
力求最简单最易懂.三层架构那些就不搞了。自己下载一个
如果是access 就用这个SQLHELPER [URL=http://hi.csdn.net/link.php?url=http://blo ......
1、建立一个Web应用程序项目,要创建解决方案并创建解决方案目录,以后可以根据需要创建其他项目,如:类库
2、用aspnet_regsql工具生成login等控件需要的后台数据库表
3、把这些表和login等登陆控件联系起来,这里最好的方法是使用IIS网站属性里面的ASP.NET标签,在那里可以编辑配置文件
其实 ......
1 示例xml文件 model.xml
<?xml version="1.0" encoding="utf-8" ?>
<DrRoot>
<SiteName>xml操作示例</SiteName>
<SiteUrl>www.abc.com.cn</SiteUrl>
.net开源论坛
<SiteKeyWord>xml操作示例</SiteKeyWord>
<FileType>gif|jpg| ......
ASP.NET页面刷新方法总结
先看看ASP.NET页面刷新的实现方法:
第一:
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二:
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script langua ......
1、由dataset生成
public void CreateExcel(DataSet ds,string typeid,string FileName)
{
HttpResponse resp;
resp = Page.Response;
resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
resp.AppendHeader("Conte ......