📄 versiondbfunc.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using feiyun0112.cnblogs.com.CSDNReader.Model;
namespace feiyun0112.cnblogs.com.CSDNReader.Functions
{
class VersionDBFunc
{
private VersionDBFunc()
{
}
public static void UpdateDBVersion(string strOldDBVersion)
{
DBFunc db = new DBFunc(false, false);
try
{
if (strOldDBVersion.CompareTo("20070125")<0)
{
RunSql(db,"20070125");
}
//SettingDBFunc s = new SettingDBFunc();
SettingDBFunc.SetSetting("DBVersion", Setting.Version);
}
catch
{
}
finally
{
db.Dispose();
}
}
private static void RunSql(DBFunc db,string strVersion)
{
string[] strSql = GetSql(strVersion);
foreach(string s in strSql)
{
if (s.Length!= 0)
{
try
{
db.ExecuteSql(s);
}
catch
{
}
}
}
}
private static string[] GetSql(string strVersion)
{
string[] strSql=new string[1];
switch (strVersion)
{
case "20070125":
strSql = new string[2];
strSql[0] = "alter table RoomInfo add column isGroup bit default 0";
strSql[1] = "alter table RoomInfo add column GroupID integer default 0";
break;
default:
break;
}
return strSql;
}
public static void UpdateVersion(string strVersion)
{
DBFunc db = new DBFunc(false, false);
try
{
//SettingDBFunc s = new SettingDBFunc();
SettingDBFunc.SetSetting("CheckedVersion", strVersion);
}
catch
{
}
finally
{
db.Dispose();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -