下面给出我的解决方案的更新,但在UPDATE语句的语法错误。请建议我。
表名是通知其字段声明为text和ntext宣布备忘录
void update(Object sender, EventArgs e)
{
con.Open();
string va=d1.SelectedItem.Value;
//ta1.Value=va;
com=con.CreateCommand();
com.CommandText="UPDATE notification SET ntext = '" + ta1.Value.Replace("\'","\'\'") + "' where nid='" + va + "'";
//com.CommandText="UPDATE notification SET notice = '" + ta1.Value + "' where id='" + va + "'";
try{
com.ExecuteNonQuery();
System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label();
lbl1.ForeColor=System.Drawing.Color.Yellow;
lbl1.BackColor=System.Drawing.Color.Blue;
lbl1.Text="Your record SUBMITED sucessfully";
ph1.Controls.Add(lbl1);
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
con.Close();}