gdjlc

培养良好的习惯,每天一点一滴的进步,终将会有收获。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 string path1 = HttpContext.Current.Server.MapPath("~/install/1.sql");
string path2 = HttpContext.Current.Server.MapPath("~/install/2.sql");

string[] strpath ={ path1, path2 };
for (int i = 0; i < strpath.Length; i++)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlData"].ConnectionString);
System.IO.StreamReader reader = new System.IO.StreamReader(strpath[i], System.Text.Encoding.GetEncoding("gb2312"));
string st = reader.ReadToEnd();
SqlCommand com = new SqlCommand(st, con);
using (con)
{
con.Open();
com.ExecuteNonQuery();
}
}




posted on 2009-11-18 22:50  gdjlc  阅读(280)  评论(0编辑  收藏  举报