有时 SQLite error near "Times": syntax error ?
SQLite error
near "Times": syntax error
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Exception: SQLite error
near "Times": syntax error
源错误:
行 247: catch (Exception e)
行 248: {
行 249: throw new Exception(e.Message);
行 250: }
行 251: finally
源文件: e:\k900\App_Code\DB.cs 行: 249
堆栈跟踪:
[Exception: SQLite error
near "Times": syntax error]
DB.execnonsql(String sql) in e:\k900\App_Code\DB.cs:249
M_Add_News.Add_News_Click(Object sender, EventArgs e) in e:\k900\M_k900\Add_News.aspx.cs:86
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
源程序:
string title = this.title.Text;//新闻标题
string newsbody = this.Body.Text;//新闻内容
string Yiji = this.Yiji.SelectedValue.Trim();//一级文档ID
string Yiji_a = this.Yiji.SelectedItem.Text.ToString();//一级文档名称
string Erji = this.Erji.SelectedValue.Trim();//二级文档ID
string Erji_a = this.Erji.SelectedItem.Text.ToString();//二级文档名称
string Flash = "0";//首页flash
string imgurl = this.PicImg.Text;
if (CheckBox1.Checked == true)
{
Flash = "1";
}
int click = 7;
string date_time = DateTime.Now.ToString();//时间
if (CheckBox1.Checked == true)
{
MessageBox.Show(this.Page, "请上传图片啦,(*^__^*) 嘻嘻…… !!");
return;
}
else
{
string sql = "insert into k900_news(title,newsbody,yi_classname,yi_classid,er_classname,er_classId,news_datetime,Flash,click,imgurl) values('" + title + "','" + newsbody + "','" + Yiji_a + "','" + Yiji + "','" + Erji_a + "','" + Erji + "','" + date_time + "','" + Flash + "'," + click + ",'" + imgurl + "')";
DB.execnonsql(sql);
this.title.Text = "";
this.Body.Text = "";
Page.ClientScript.RegisterStartupScript(this.GetType(), "Startup", "<script>alert('(*^__^*) 嘻嘻…… !!新闻添加成功,系统将自动清空内容!!!!')</script>");//无刷新弹出对话框
return;
}
是有时出错,有时不出错!!