出错提示:' ' 附近有语法错误。   这个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();

解决方案 »

  1.   

     where ID= '" + getid + "' ", con); 
      

  2.   

    "insert into liuyan(回复) values('" + TextBox1.Text + "') where ID= '" + getid + "'"
    不明白为什么要括号~
      

  3.   

     這樣寫不就可以了:
    SqlCommand cmd = new SqlCommand("insert into liuyan(回复) values('" + TextBox1.Text + "') where ID= " + getid + " ", con); 
      

  4.   


      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();
      

  5.   

    new SqlCommand("insert into liuyan(回复) values('" + TextBox1.Text.Replaace("'","''") + "') where ID= ('" + getid + "' )", con); 
      

  6.   

    除了jiang_jiajia10 ,其他的还是有错误....非常感谢jiang_jiajia10