adoquery1.SQL.Add('update upload set period='+label3.Caption+',times='+label4.Caption+',corp_id='+label2.Caption+'');period 是文本的times corp_id都是数字形

解决方案 »

  1.   

    adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption+'');
      

  2.   

    adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption);
      

  3.   

    adoquery1.SQL.Add('update upload set period='+QuotedStr(label3.Caption)+',times='+QuotedStr(label4.Caption)+',corp_id='+QuotedStr(label2.Caption));
      

  4.   

    提示什么错误?
    前面注意加个adoquery.sql.clear;
      

  5.   

    adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='''+label4.Caption+''',corp_id='''+label2.Caption+'''');
      

  6.   

    看你是什么数据库,涉及到类型转换问题了
    因为你的times和corp_id都是数值型,采用convert或者to_number类似的函数来转换
    像楼上的写的只能针对字符型的,数值、日期型的就需要转换,里面的参数自己查下
    例如:
    adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times=convert('+label4.Caption+'),corp_id='+label2.Caption+'');
      

  7.   

    sql server 就用convert函数转换,oracle就用to_number转换,日期的用to_date
      

  8.   

    adoquery1.sql.clear;
    adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='''+label4.Caption+''',corp_id='''+label2.Caption+'''');
      

  9.   


     adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption);这个对了~