我写select没问题:
SQL.Add('select * from ClientInfo where ID='''+ClientID+
           ''' and username='''+ClientUser+
           ''' and password='''+ClientPassword+'''');可如法写insert就不行了:
SQL.Add('insert into LogInfo values ('''+ IntToStr(counter) + ''','''+ClientID+''','''+ ClientIP+ ''',1,'''+ TimeToStr(DateTime)+''')'''');

SQL.Add('insert into LogInfo values ('+ IntToStr(counter) + ','+ClientID+','+ ClientIP+ ',1,'+ TimeToStr(DateTime)+')');我该怎么写,能帮我讲将单引号的概念吗?

解决方案 »

  1.   

    你在写一个语句输出看一下
    showmessage(sql.text);这样看得就比较直观了
      

  2.   

    SQL.Add('insert into LogInfo values ('''+ IntToStr(counter) + ''','''+ClientID+''','''+ ClientIP+ ''',1,'''+ TimeToStr(DateTime)+''')')应该是这样
      

  3.   

    同意Huayuxing,
    這樣好了!
    SQL.Text := 
    format('Insert into LogInfo values(''%s'',''%s'',''%s'',1,''%s'')',[Inttostr(counter),clientID,ClientIP,TimeToStr(DateTime)]);
      

  4.   

    严格说 ' 再和其他'一起使用时只是个转义字符,就是说:在字符串中''是代表一个’。简单说:'+s+'代表用变量S的值来代替'+s+'S是数值型,而 '''+S+'''中的S是字符串类型同样用S的值代替'+S+','''+S+'''就变成了'S'。也不知我说的够不够明白。:(
      

  5.   

    應該這樣
    SQL.Add('select * from ClientInfo where ID='+''''+ClientID+''''+
         'and username='+''''+ClientUser+''''+
    'andpassword='+''''+ClientPassword+'''');