update stuffsource set" + amend +"='" + pvalue +"'";amend 是变量,必须引起来

解决方案 »

  1.   

    把SQL语句打出来,在查询分析器中看看错误的原因
      

  2.   

    同意loveprograming() 
    如果“amend”不是表中的字段,那问题就出在这了
      

  3.   

    " if exists(select * from stuffsource where bh='"+pid+"')    没注意到最后少了一个双引号吗?
    又亦或bh如果不是字符型就不用单引号了
      

  4.   

    pvalue 这个字段很可能不是字符型的,不用单引号,仔细再看看。
      

  5.   

    string pid = TextBox1.Text.Trim();
    string amend = TextBox2.Text.Trim();
    string pvalue = TextBox3.Text.Trim();
    string str = " if exists(select * from stuffsource where bh='"+pid+"')
    update stuffsource set amend='"+pvalue+"' ";string pid = TextBox1.Text.Trim();
    string amend = TextBox2.Text.Trim();
    string pvalue = TextBox3.Text.Trim();
    string str = " if exists(select * from stuffsource where bh='"+ pid + "') update stuffsource set " + amend" + "='" + pvalue + "'";//三个文本框不能为空或者null