sql := Format('Select * From Table1 Where ID=%d', [gid]);

解决方案 »

  1.   

    sql='select * from table1 where id=''''+gid+''''
      

  2.   

    对不起,写错了。 
    sql='select * from table1 where id=''+gid+'''
      

  3.   

    sql := Format('Select * From Table1 Where ID=%d', [gid]);我是写在query1.Filter:=' '里怎么做到?sql='select * from table1 where id=''''+gid+''''不行
      

  4.   

    sql='select * from table1 where id=''+gid+'''这样可以,
      

  5.   

    sql='select * from table1 where id='+gid;
      

  6.   

    sql='select * from table1 where id='+gid+
      

  7.   

    /////////////////////////
    Filter := Format('id=%d', [gid]);
    /////////////////////////
      

  8.   

    sorrysql='select * from table1 where id='+gid;
      

  9.   

    sql='select * from table1 where id=''+gid+'''
    也不行,请问你用它试成功过吗?
      

  10.   

    如果还不行的话,
    你在Query右击,点Fields editor....然后再右击.
    添加所有字段.
      

  11.   

    sql='select * from table1 where id='+gid;也试过,不行呀
      

  12.   

    Warning:
    回复人: zx_wang(wzx) 
      sql='select * from table1 where id='+gid;
      这句显然不对,gid是Integer型变量!怎么与字符串做+运算?!人家是要在Filter中!写的Select * From Table1 Where ......
    这样的语句,它能接受吗?!不解中。
      

  13.   

    对不起,没有看清题。前面写错了。见谅
    你的gid是一个整形的话,那就写为
    sql='select * from table1 where id='+gid;
    不过在有些数据库里面,将一个整形用引号引起来也没错
      

  14.   

    sql='select * from table1 where id='+ inttostr(gid)如果gid是整数型的
      

  15.   

    用Format();
    或者用数据库的转换函数,具体函数根据数据库不同而不同,查一下你用的数据库函数资料吧。
      

  16.   

    写法如下:
    sql='select * from table1 where id='''+ inttostr(gid)+''''
    你可以试试
      

  17.   

    我已经试过了,没有问题的。
    写法如下:
    sql='select * from table1 where id='''+ inttostr(gid)+''''
    你可以试试 
      

  18.   

    什么问题嘛:
    sql='select * from table1 where id='+inttostr(gid);
    还有就是你的gid一定要是integer的
      

  19.   

    谢谢大家的回复,我用的是sqlserver的数据库,我会去查找相关资料。大家所提出的方法我都会去试试。谢谢