asp版本的免费版本无考试系统,请打开update/index.aspx
找到如下代码删除,再运行
//转移考试表KS_SJClass
DataFactory.ExecuteNonQuery("Delete From KS_SJClass");
InnerHtml("正在转移表KS_SJClass的记录!");
TransSJClass();
CheckAndFixSJClass(0);
#region 更新分类缓存
cache = KSCache.GetCacheService();
cache.RemoveObject("/CMS/CacheSJCategoryTable");
cache.RemoveObject("/CMS/CacheSJCategoryURL");
#endregion
InnerHtml("<font color=green>成功转移表KS_SJClass 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJ
InnerHtml("正在转移表KS_SJ的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJ");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJ] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJ where [dtfs]<>3 Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
sqlStr = @"insert into KS_SJ([id]
,[Title],[ClassID] ,[TypeID]
,[ProvinceID],[KSSJ] ,[Score]
,[Money],[Times],[MustLogin],[GroupIDs],[DepartIds],[CopyFrom],[Author] ,[Inputer]
,[Intro],[Recommend],[Popular],[IsTop] ,[Comment]
,[IsTjDa],[IsSaveAnswer] ,[IsDelRecord]
,[Dtfs],[Verify],[AddDate] ,[Hits],[OpenTimeLimit]
,[ScorePubType]
,[ShowOn3G]) values";
sqlStr += "(" + dr["id"].ToString() + ",'"+Quote(dr["title"].ToString())+"',"+dr["tid"].ToString()+",0,0,"+dr["kssj"].ToString()+","+Utils.StrToFloat(dr["sjzf"].ToString())+",";
sqlStr += Utils.StrToFloat(dr["sq"].ToString()) + "," + dr["times"].ToString() + ",1,'','','" + dr["form_url"].ToString() + "','" + Quote(dr["form_user"].ToString()) + "','"+dr["user"].ToString()+"',";
sqlStr +="'"+Quote(dr["sj"].ToString())+"',"+dr["recommend"].ToString()+",0,0,0," + Utils.StrToInt(dr["allowtj"].ToString()) + ",1,1,";
sqlStr +=(dr["dtfs"].ToString()=="2"?3:1)+","+dr["verific"].ToString()+",'"+dr["date"].ToString()+"',"+dr["hits"].ToString()+",0,";
sqlStr +="0,1)";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJ] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJ 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJTK
InnerHtml("正在转移表KS_SJTK的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJTK");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJTK] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJTK where did<>0 Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
int tmtype = 0;
int optionNum = 0;
string typeName = string.Empty;
switch (Utils.StrToInt(dr["Tmtype"].ToString()))
{
case 1:
tmtype = 1;
typeName = "主观题";
break;
case 2:
tmtype = 2;
optionNum = 4;
typeName = "单选题";
break;
case 3:
tmtype = 3;
typeName = "多选题";
optionNum = 4;
break;
case 4:
tmtype = 4;
typeName = "判断题";
optionNum = 2;
break;
case 5:
tmtype = 3;
typeName = "多选题";
optionNum = 6;
break;
case 6:
tmtype = 3;
typeName = "多选题";
optionNum = 5;
break;
case 7:
tmtype = 5;
typeName = "填空题";
break;
case 8:
tmtype = 2;
typeName = "单选题";
optionNum = 5;
break;
}
sqlStr = @"insert into KS_SJTK([TmId]
,[TypeId],[ClassID],[Tmtype] ,[Title],[Tmnr]
,[DAJS] ,[tmfs],[Answer] ,[OptionNum] ,[OrderID]
,[IsRnd],[IsMedia],[MediaUrl] ,[MediaTxt] ,[DAJSMedia]
,[Difficulty] ,[KnowledgeId] ,[KeyWords]) values";
sqlStr += "(" + dr["id"].ToString() + "," + dr["did"].ToString() + "," + dr["tid"].ToString() + "," + tmtype + ",'" + Quote(dr["title"].ToString()) + "','" + Quote(dr["tmnr"].ToString()) + "','" + Quote(dr["DAJS"].ToString()) + "'," + Utils.StrToFloat(dr["tmfs"].ToString()) + ",";
sqlStr += "'" + Quote(dr["Answer"].ToString()) + "'," + optionNum + "," + dr["num"].ToString() + "," + Utils.StrToInt(dr["IsRnd"].ToString()) + "," + Utils.StrToInt(dr["IsMedia"].ToString()) + ",";
sqlStr += "'" + Quote(dr["MediaUrl"].ToString()) + "','" + Quote(dr["MediaTxt"].ToString()) + "','" + Quote(dr["DAJSMedia"].ToString()) + "',";
sqlStr += Utils.StrToInt(dr["Difficulty"].ToString()) + "," + Utils.StrToInt(dr["zsdId"].ToString()) + ",'')";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJTK] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJTK 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJTK
InnerHtml("正在转移表KS_SJTK的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJTMType");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJTMType] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJTK where did=0 Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
int tmtype = 0;
string typeName = string.Empty;
switch (Utils.StrToInt(dr["Tmtype"].ToString()))
{
case 1:
tmtype = 1;
typeName = "主观题";
break;
case 2:
tmtype = 2;
typeName = "单选题";
break;
case 3:
tmtype = 3;
typeName = "多选题";
break;
case 4:
tmtype = 4;
typeName = "判断题";
break;
case 5:
tmtype = 3;
typeName = "多选题";
break;
case 6:
tmtype = 3;
typeName = "多选题";
break;
case 7:
tmtype = 5;
typeName = "填空题";
break;
case 8:
tmtype = 2;
typeName = "单选题";
break;
}
sqlStr = @"insert into KS_SJTMType([TypeID]
,[TmType],[TypeName] ,[Intro],[SJID],[OrderID]) values";
sqlStr += "(" + dr["id"].ToString() + "," + tmtype + ",'" + typeName + "','" + Quote(dr["tmnr"].ToString()) + "'," + dr["kid"].ToString() + "," + dr["num"].ToString() + ")";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJTMType] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJTK 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJRndZJ
InnerHtml("正在转移表KS_SJRndZJ的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJRndZJ");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJRndZJ] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJRndZJ Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
int tmtype = 0;
string typeName = string.Empty;
switch (Utils.StrToInt(dr["Tmtype"].ToString()))
{
case 1:
tmtype = 1;
typeName = "主观题";
break;
case 2:
tmtype = 2;
typeName = "单选题";
break;
case 3:
tmtype = 3;
typeName = "多选题";
break;
case 4:
tmtype = 4;
typeName = "判断题";
break;
case 5:
tmtype = 3;
typeName = "多选题";
break;
case 6:
tmtype = 3;
typeName = "多选题";
break;
case 7:
tmtype = 5;
typeName = "填空题";
break;
case 8:
tmtype = 2;
typeName = "单选题";
break;
}
sqlStr = @"insert into KS_SJRndZJ([ID]
,[SJID],[TmType] ,[TmIds],[OrderID]
,[Title] ,[FS]
,[Num] ,[Intro]) values";
sqlStr += "(" + dr["id"].ToString() + "," + dr["sjid"].ToString() + "," + tmtype + ",'" + Quote(dr["tmids"].ToString()) + "'," + dr["orderid"].ToString() + ",'" + Quote(dr["title"].ToString()) + "',"+dr["fs"].ToString()+","+dr["num"].ToString()+",'')";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJRndZJ] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJRndZJ 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJZSD
InnerHtml("正在转移表KS_SJZSD的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJKnowledge");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJKnowledge] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJZSD Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
sqlStr = @"insert into KS_SJKnowledge([id] ,[title] ,[classid],[content] ,[username] ,[adddate]) values";
sqlStr += "(" + dr["id"].ToString() + ",'" + Quote(dr["title"].ToString()) + "'," + dr["classid"].ToString() + ",'" + Quote(dr["content"].ToString()) + "','admin','" + dr["adddate"].ToString() + "')";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJKnowledge] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJZSD 共计" + k + " 条记录!</font>");
//转移试卷表KS_SJZSD
InnerHtml("正在转移表KS_SJCTB的记录!");
DataFactory.ExecuteNonQuery("Delete From KS_SJCTB");
k = 0;
cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJCTB] On";
cmd.ExecuteNonQuery();
using (DataTable dt = GetDataTable("select * from KS_SJCTB Order by id", 0))
{
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
sqlStr = @"insert into KS_SJCTB([id]
,[tmid],[userid],[adddate] ,[flag]) values";
sqlStr += "(" + dr["id"].ToString() + "," + dr["tmid"].ToString() + "," + dr["userid"].ToString() + ",'" + dr["adddate"].ToString() + "',0)";
cmd = new SqlCommand(sqlStr, conn);
k += cmd.ExecuteNonQuery();
}
}
}
cmd.CommandText = "SET IDENTITY_INSERT [KS_SJCTB] Off";
cmd.ExecuteNonQuery();
InnerHtml("<font color=green>成功转移表KS_SJCTB 共计" + k + " 条记录!</font>");