添加引用。system configuration
configurationManager.AppSettings[“”]
<appSetings>
<add key=“” value=“”>
</appSetings>
<connectionStrings>
<add key=“” connectionString=“”>
</connectionString>
configurationManager.connecSring[“”].ConnectionString
ExcuteScalar();
SqlDataReader reader=ExcuteReader(); Reader 指针,指向表头
reader.Read();
生产者消费者问题-----sql connection的连接池
httoapplication ——————对象池技术
App.config里面添加配置文件
while(reader.Read())
{
}
string conStr=configurationManage.connectionStrings[].connectionstring;
string filename=string.empty;
using(SaveFileDialog std=new SaveFileDialog())
{
filename=std.Filename;
}
StreamWriter writer=new StreamWriter(filename)
writer.WriteLine(“”)
reader.HasRows //reader 一个属性。。判断是否含有数据,返回bool类型
reader 一直占用SqlConnectiion对象,
如果重新执行 cmd.CommandText得等到reader释放刚才connection对象
DateTime.now.substract()
sql防止注入:
cmd.Parameters.Add(“@username”,txtUsername.text)