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();
}
}




相关文章:

  • 2021-10-21
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
  • 2021-12-05
  • 2021-09-14
  • 2021-11-28
猜你喜欢
  • 2021-12-28
  • 2021-08-09
  • 2021-09-07
  • 2022-01-19
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案