求救,急急急急急急,数据写不进数据库
[code=C#][/code]protected void btnSave_Click(object sender, EventArgs e)
{
CC.ExSql("UPDATE tb_News SET newsTitle = '" + this.txtNewsTitle.Text + "', newsContent = '" + this.TextBox1.Text + "', newsStyle = '" + this.ddlNewsStyle2.SelectedValue.ToString() + "',issueDate = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' WHERE (ID = '" + Request.QueryString["id"] + "')");
Response.Write(CC.MessageBox("数据修改成功!", "newlist.aspx"));
}
这是新闻的编辑页,可发现,点击按钮后数据库的数据没有修改,急,请高手看看
------解决方案-------------------- 1、
CC.ExSql("UPDATE tb_News SET newsTitle = '" + this.txtNewsTitle.Text + "', newsContent = '" + this.TextBox1.Text + "', newsStyle = '" + this.ddlNewsStyle2.SelectedValue.ToString() + "',issueDate = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' WHERE ID = '" + Request.QueryString["id"] + "'");
2、
CC.ExSql("UPDATE tb_News SET newsTitle = '" + this.txtNewsTitle.Text + "', newsContent = '" + this.TextBox1.Text + "', newsStyle = '" + this.ddlNewsStyle2.SelectedValue.ToString() + "',issueDate = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' WHERE ID = " + Request.QueryString["id"] + "");
------解决方案--------------------
string strSQL = "UPDATE tb_News SET newsTitle = '" + this.txtNewsTitle.Text + "', newsContent = '" + this.TextBox1.Text + "', newsStyle = '" + this.ddlNewsStyle2.SelectedValue.ToString() + "',issueDate = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' WHERE ID = " + Request.QueryString["id"];
Response.Write(strSQL); //页面上输出SQL语句,然后看看那个地方不对,就行了
CC.ExSql(strSQL);