private void readSql()
{
string path = MainForm.pathstr+@".\SQLServer.ini";
System.IO.StreamReader sr = new System.IO.StreamReader(path);
string temp;
string Sqlpath="";
while((temp = sr.ReadLine()) != null)
{
Sqlpath+= temp;
}
myConn.ConnectionString = Sqlpath;
sr.Close();
}
上面是一段链接数据库的代码,麻烦大家帮忙解释一下,谢谢!
{
string path = MainForm.pathstr+@".\SQLServer.ini";
System.IO.StreamReader sr = new System.IO.StreamReader(path);
string temp;
string Sqlpath="";
while((temp = sr.ReadLine()) != null)
{
Sqlpath+= temp;
}
myConn.ConnectionString = Sqlpath;
sr.Close();
}
上面是一段链接数据库的代码,麻烦大家帮忙解释一下,谢谢!
学习一下System.IO.StreamReader类的使用吧。
http://search.microsoft.com/results.aspx?mkt=zh-CN&setlang=zh-CN&q=System.IO.StreamReader