#42000You have an error in your SQL syntax:check the manual that corresponds to your MySQL server for the right syntax  to use near  '4','','2008-06-24 12:02:16')4,'','2008-06-24 12:02:16')4,'','2008-06-24 12:02:16'' at line 1

解决方案 »

  1.   

    MySQL....恶梦,呵呵。个人看法
      

  2.   

    function TfrmBaseInfo.Get_CarType_MaxId():String;
    Var StrSql:String;
    begin
        StrSql:='Select max(lg_ct_no) as maxid from lgsb_carType';
        With DataModule1.Query do
        begin
           If(Active) Then Close;
           SQL.Clear;
           SQL.Add(StrSql);
           Open;
           If(Trim(FieldByName('maxid').asString) = '') then
              Result := '1'
           else Result := IntToStr(StrToInt(FieldByName('maxid').asString)+1);
        end;
    end; procedure TfrmBaseInfo.RzBitBtn1Click(Sender: TObject);
    var StrSql1:String;
    begin
    StrSql1 := 'insert into lgsb_carType(lg_ct_no,lg_ct_name,lg_systime)values(';
     StrSql1 := StrSql1 + Get_CarType_MaxId()+','''+Edit1.text+''',''' +DateTimeToStr(Now) + ''')';
    UpdateExcute(DataModule1.Query, StrSql1);end;
      

  3.   

    是不是Get_CarType_MaxId()返回String
     而'insert into lgsb_carType(lg_ct_no,lg_ct_name,lg_systime)values('Get_CarType_MaxId()+','''; 
    StrSql1 := StrSql1  +Edit1.text+''',''' +DateTimeToStr(Now) + ''')'; 中lg_ct_no是int型
      

  4.   

    我也是刚学mysql ,也遇到了类似的问题
      

  5.   

    学习 mysql 以前 一直用工具