为什么错误的时候,我在网站上载源文件。
请指示我。
错误 - 操作必须使用一个可更新的查询
。
我更新代码看起来如下void submit(Object sender, EventArgs e)
{
con.Open();
string va=d1.SelectedItem.Value;
com=con.CreateCommand();
com.CommandText="UPDATE notification SET notice = '" + ta1.Value.Replace("\'","\'\'") + "' where id='" + 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();
}