查询语句如下: select distinct type from store where name = "five"
在tquery控件的sql语句中随便我我怎么写,都出现这个错误:
“参数不足,期待是1”我的写法有:sql.Text:='select distinct type from store where name ="five";'; 或者是
sql.Add('select distinct type '); 
sql.Add('from store ') ;
sql.add('where name = "five"');为什么“  where name ="five";”这句有问题呢?
那该怎么写那?

解决方案 »

  1.   

    ms sql2000的写法:
    sql.Text:='select distinct type from store where name =''five'';';
    access的写法:
    sql.Text:='select distinct type from store where name ="five";';
      

  2.   

    ms sql2000写法:
    sql.Add('select distinct type '); 
    sql.Add('from store ') ;
    sql.add('where name = ''five''');
    access写法:
    sql.Add('select distinct type '); 
    sql.Add('from store ') ;
    sql.add('where name = "five"');
      

  3.   

    to year2000bug:
    我用的就是access啊,
    你的写法不是和我的一样的吗?
    不行啊,那样些就出现那个错误,
      

  4.   

    恩,谢谢你的提醒,
    把你的答案反回来就对了,
    access是sql.add('where name = ''five''');
      

  5.   

    在delphi中必须用''five''不能用""跟数据库没有关系!
      

  6.   

    應該是sql.Text:='select distinct type from store where name =''five''';吧。
    好象ACCESS裡面,字符串也是用單引號的哦。
      

  7.   

    可能這樣子寫吧~~
     
    Sql Add ('select distinct type from store where name ='+''''+five+'''');這是加在 Tquery 控件語句里的﹗
      

  8.   

    将你的 SQL 语句放到 Access 中去执行一下,看看 Access 给你提示的是什么。
      

  9.   

    five旁边要用两个单引号而不要用双引号,应该如下:
    sql.Add('select distinct type from store where name = ''five''');
      

  10.   

    sql server里面是怎么样的,我现在没有试,可能是像hongqing162说的那样吧,