strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('''+txtzl.Text +''''+ txtname.text +''''+txtQty.text+''''+txtDate.text +''')' ;

解决方案 »

  1.   

    这样容易出错可以写做参数
    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values(:a1,:a2,:a3,:a4)';
    adoquery1.paramerts.paramertename('a1').value:=txtzl.Text ;
      

  2.   

    strsql="insert into zhiling (zldno,partno,qty,zdate)values("' & txtzl.text & '","' & txtname.text & '","' & txtqty.text & '"," & cdate(txtdate.text) & ")"
      

  3.   

    试试这个吧,不知道你的字段类型:
    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('+txtzl.Text +','''+ txtname.text +''','''+txtQty.text+''','''+txtDate.text +''')' ;
      

  4.   

    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('''
    +txtzl.Text+''','''+txtname.text+''','''+txtQty.text+''','''
    +txtDate.text+''')';
      

  5.   

    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('+quotedstr(txtzl.Text) +','+quotedstr( txtname.text) +','+quotedstr(txtQty.text)+','+quotedstr(txtDate.text) +')' ;
      

  6.   

    源碼:
    procedure TfrmZL.BitBtn1Click(Sender: TObject);
    var
      strSql:string;
    begin
      
      dm.ADOQuery1.close;
      dm.ADOQuery1.sql.Clear;
      strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('+quotedstr(txtzl.Text) +','+quotedstr( txtname.text) +','+quotedstr(txtQty.text)+','+quotedstr(txtDate.text) +')' ;
      dm.ADOQuery1.SQL.Add(strsql);
      dm.ADOQuery1.ExecSQL ;
      dm.ADOQuery1.Close ;
    end;end.
      

  7.   

    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('''+txtzl.Text +''','''+ txtname.text +''','''+txtQty.text+''','''+txtDate.text +''')' ;
      

  8.   

    OK! Thanks
    strsql:='insert into zhiling (zldno,Partno,Qty,ZDate) values('+quotedstr(txtzl.Text) +','+quotedstr( txtname.text) +','+quotedstr(txtQty.text)+','+quotedstr(txtDate.text) +')' ;