修改第一个小项目收获2016年10月28日

向文本文件中最低部插入内容

FileStream fs = null;
string filePath = @"C:UsersAdministratorDesktopFactoryCalendar1FactoryCalendar/log.txt";
Encoding encoder = Encoding.UTF8;
byte[] bytes = encoder.GetBytes("************** "+DateTime.Now.ToString() + " ");
try
{
fs = File.OpenWrite(filePath);
//设定书写的开始位置为文件的末尾
fs.Position = fs.Length;
//将待写入内容追加到文件末尾
fs.Write(bytes, 0, bytes.Length);

}
catch (Exception ex)
{
Console.WriteLine("文件打开失败{0}", ex.ToString());
}
finally
{
fs.Close();
}

Page.IsPostBack:当前请求是否第一次打开

.net中每当点击一次按钮都将进行页面刷新。

换行符是  ,注意顺序不能写错

一行sql语句同时修改多行代码的方法:

update 表明 set 字段名1 = decode(ID,1,'值',2,'值',3,'值'),字段名2 = decode(ID,1,'值',2,'值',3,'值') 

原文地址:https://www.cnblogs.com/quwujin/p/6007798.html