请帮助我,我在本地网站上有这个代码,有时会成功,有时却没有。 当我从服务器检查事件查看器时,会看到此错误:
Event code: 3005
Event message: An unhandled exception has occurred.
There was an error parsing the query.
[ Token line number = 2,Token line offset = 7,Token in error = t ]
at Test4.ISITPROC.subBtnP_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
那是我的代码:
// Create New Process Function
public void createProc(EProc proc)
{
localDBConn sqldb = new localDBConn();
sqldb.connectDB();
string stSQL =
"INSERT INTO Process (pID, reqID, engID, moduleName, priority, projTeam, estProjDur, startDate, finishDate, description, comments)"+ "VALUES('";
stSQL += proc.pID + "','" + proc.ReqID + "','" + proc.EngID
+ "','" + proc.ModuleName + "','" + proc.Priority
+ "','" + proc.ProjTeam + "','" + proc.EstProjDur
+ "','" + proc.StartDate + "','" + proc.FinishDate
+ "','" + proc.Description + "','" + proc.Comments + "')";
SqlCeCommand cmd = new SqlCeCommand(stSQL, sqldb.sqlCon);
try
{
cmd.ExecuteNonQuery();
sqldb.closeDB();
}
catch (Exception eX)
{
sqldb.closeDB();
throw new Exception("cDocument: Error occurred "
+ Environment.NewLine + eX.Message);
}
}