出错提示:' ' 附近有语法错误。 这个sql语句是这样写的吗? string getid = Request["id"].ToString();
string conm = "Server=.;Database= wuliu;Integrated Security=SSPI";
SqlConnection con = new SqlConnection(conm);
con.Open(); SqlCommand cmd = new SqlCommand("insert into liuyan(回复) values('" + TextBox1.Text + "') where ID= ('" + getid + "' )", con);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
Response.Write("<script> alert('留言成功');</script>)");
}
con.Close();
string conm = "Server=.;Database= wuliu;Integrated Security=SSPI";
SqlConnection con = new SqlConnection(conm);
con.Open(); SqlCommand cmd = new SqlCommand("insert into liuyan(回复) values('" + TextBox1.Text + "') where ID= ('" + getid + "' )", con);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
Response.Write("<script> alert('留言成功');</script>)");
}
con.Close();
解决方案 »
- 这样的数据库表,应该怎么设计?
- 项目经理请进,数据安全专家请进
- 关于gridview控件的使用
- 解释正则表达式
- 怎么样能动态的增加DropDownList中的一项?
- 刚注册成功。请多关照。DataGrid模版列CheckBox的选择状态,在分页后保存的问题。
- 请问有没有用asp.net写的BBS系统源码下载?谢谢!
- 请教高手:如何用代码激活ASP.NET的validationsummary控件?
- 关于datagrid
- 越学越糊涂,<input type=button runat="server>与<input type=submit runat="server"区别何在?
- asp.net网站 整站商品实现模糊查询
- 如何用ASP.NET将access导入到SQL数据库
不明白为什么要括号~
SqlCommand cmd = new SqlCommand("insert into liuyan(回复) values('" + TextBox1.Text + "') where ID= " + getid + " ", con);
string getid = Request["id"].ToString();
string strreply = TextBox1.Text.Trim();
string conm = "Server=.;Database= wuliu;Integrated Security=SSPI";
SqlConnection con = new SqlConnection(conm);
con.Open(); SqlCommand cmd = new SqlCommand("update liuyan set 回复='" + strreply + "'where(id='" + getid + "')", con);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
Response.Write(" <script> alert('留言成功'); </script>)");
}
con.Close();