应该是这样吧,你多了一个‘
DataModule2.Queryinfo.SQL.Add('select * from info where ent_name ='+'''+ent_name.Text+'''');
下面的你自己改
试试

解决方案 »

  1.   

    DataModule2.Queryinfo.SQL.Add('insert into info');
     DataModule2.Queryinfo.SQL.Add('(ent_name,principal,address,phone,order,project,memo)');
      DataModule2.Queryinfo.SQL.Add('values ('
    +QuotedStr(ent_name.Text)
    +','+ QuotedStr(principal.Text)
    +','+QuotedStr(address.Text)
    +','+QuotedStr(phone.Text)
    +','+QuotedStr(order.Text)'
    +','+QuotedStr(project.Text)
    +','+QuotedStr(memo.Text)
    +')');
      

  2.   

    ('(ent_name,principal,address,phone,order,project,memo)');
      DataModule2.Queryinfo.SQL.Add('values('+'"'+ent_name.Text+'"'+','+'"'+principal.Text+'"'+','+'"'+address.Text+'"'+','+'"'+phone.Text+'"'+','+'"'+order.Text+'"'+','+'"'+project.Text+'"'+','+'"'+memo.Text+'"'+')');
     DataModule2.Queryinfo.Active:=true;//这句话多余呀,Queryinfo的语句已经clear了;
     DataModule2.Queryinfo.ExecSQL;
      

  3.   

    ('+'"'+ent_name.Text+'"'+','+'"'+principal.Text+'"'+','+'"'+address.Text+'"'+','+'"'+phone.Text+'"'+','+'"'+order.Text+'"'+','+'"'+project.Text+'"'+','+'"'+memo.Text+'"'+')');
    友问题
      

  4.   

    DataModule2.Queryinfo.SQL.Add('insert into info');
     DataModule2.Queryinfo.SQL.Add('(ent_name,principal,address,phone,order,project,memo)');
      DataModule2.Queryinfo.SQL.Add('values('+''''+ent_name.Text+''''+','+''''+principal.Text+''''+','+''''+address.Text+'"'+','+'"'+phone.Text+'"'+','+'"'+order.Text+'"'+','+'"'+project.Text+'"'+','+'"'+memo.Text+'"'+')');1、引号不要用'"',用''''
    2、注意加入语句时 加入空格
     如:
     SQL.Add(‘ ent_name,principal,address,phone,order,project,memo) ');
      

  5.   

    with DataModule2.Queryinfo do
    begin
    close;SQL.Clear;
    SQL.Add('insert into info (ent_name,principal,address,phone,order,project,memo) ');
    SQL.Add('values('''+ent_name.Text+''','''+principal.Text+''','''+address.Text+''','''+phone.Text+''','''+order.Text+''','''+project.Text+''','''+memo.Text+''') ');
    ExecSQL;
    end;
      

  6.   

    东方不亮是对了,我每次都用这个函数:function QuotedStr(const S: string): string;当使用多字节字符时,请使用:
    function AnsiQuotedStr(const S: string; Quote: Char): string;