StrSQL:='insert into info (id,title,content,inputdate,inputperson,re,areaid,type)'+
           ' values ('+inttostr(artid)+','''+strtitle+''','''+strcontent+''',to_date('''+
           inputdate+''',''yyyy-mm-dd''),'''+inputperson+''','''+
           re+''','''+frmlogin.ArtArea+''','''+strtype+''')';
frmlogin.ArtArea 内如果有单引号,程序总报错,怎么办??

解决方案 »

  1.   

    先把单引号用CHR(34)多少记不准 了,替换,然后 再取出来的时候再替换回来
      

  2.   

    i_dmDB.i_adoqryLTmp.Close;
       i_dmDB.i_adoqryLTmp.SQL.Clear;
       i_dmDB.i_adoqryLTmp.SQL.Add('insert into T_VehicleRec(WayID,PassDate,PassTime,ClassOrd,UserID,VehicleType,Fare,BillNo,ImageFile,UpFlag)');
       i_dmDB.i_adoqryLTmp.SQL.Add('Values('+IntToStr(r_TradeInfo.WayNo)+','''+
    //                                DateToStr(now)+''','''+TimeToStr(now)+''','+
                                    r_TradeInfo.PassDate+''','''+r_TradeInfo.PassTime +''','+
                                    IntToStr(r_UserInfo.ClassNo)+','''+
                                    FormatFloat('000000',r_UserInfo.No)+''','''+
                                    CarName+''','+
                                    IntToStr(CarPrice)+','''+
                                    FormatFloat('00000000',i)+''','''+
                                    imagefilename+''','+
                                    IntToStr(bUpFlag)+')');
       i_dmDB.i_adoqryLTmp.ExecSQL;
    //这样就可以,看看她的规律