Exemplo n.º 1
0
        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="scriptPath"></param>
        public static void ExcuteScript(string scriptPath)
        {
            // 遍历所有的脚本文件
            string[] fileList = System.IO.Directory.GetFiles(scriptPath);
            foreach (string file in fileList)
            {
                if (Path.GetExtension(file).ToLower() != ".sql")
                {
                    continue;
                }
                FileStream   fileStream   = new FileStream(file, FileMode.Open);
                StreamReader streamReader = new StreamReader(fileStream, Encoding.Default);
                string       cmdText      = streamReader.ReadToEnd();
                streamReader.Close();
                fileStream.Close();

                if (cmdText.Trim().Length == 0)
                {
                    continue;
                }

                //执行脚本
                UpdScriptDao.ExcuteScript(cmdText);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新版本号
 /// </summary>
 /// <param name="model"></param>
 public static void UpdateParam(ParamModel model)
 {
     UpdScriptDao.UpdateParam(model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 插入版本号
 /// </summary>
 /// <param name="model"></param>
 public static void InsertParam(ParamModel model)
 {
     UpdScriptDao.InsertParam(model);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 获取版本号
 /// </summary>
 /// <param name="model"></param>
 public static ParamModel GetParamByCode(string paramCode)
 {
     return(UpdScriptDao.GetParamByCode(paramCode));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 连接数据库
 /// </summary>
 /// <param name="connectionString"></param>
 /// <returns></returns>
 public static void ChkConnectSetting()
 {
     UpdScriptDao.ChkConnectSetting();
 }