(一)定义ado对象:

 SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
              {
                  DbType = SqlSugar.DbType.MySql,
                 
                  ConnectionString = "Data Source=127.0.0.1/xx;User ID=xx;Password=xx;",
                  IsAutoCloseConnection = true, //不设成true要手动close

              });

(二)定义SQL脚本文件路径:

 string path = "D:\\WORK\\练习\\html\\rwar_rec_{0}.sql";
Dictionary<int, int> dicRt = new Dictionary<int, int>();

(三)执行SQL脚本:


            for(int i = 1; i < 30; i++)
            {
                string file=string.Format(path, i);

                StreamReader rd = new StreamReader(file, System.Text.Encoding.UTF8);

                string sql=rd.ReadToEnd();
                rd.Close();

                if(sql!="")
                {
                   int a = Db.Ado.ExecuteCommand(sql);
                    dicRt[i] = a;
                }
            }