首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

,数据写不进数据库

2012-09-10 
求救,急急急急急急,数据写不进数据库[codeC#][/code]protected void btnSave_Click(object sender, Event

求救,急急急急急急,数据写不进数据库
[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);

热点排行