delphi sql查询显示语句

来源:百度知道 编辑:UC知道 时间:2024/05/07 03:31:23
表名:flash
字段:flashname
字段:类型
字段:大小

flashname字段值:OK
类型字段值:OK1
大小字段值:OK2

有一个combobox1里已有字段名(flashname)
可以用一个字段名显示他的所有字段值吗??

给个代码吧。。谢谢。。。
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from flash where (flashname like ''%'+ComboBox1.text+'%'')');
adoquery1.Open;

这是查询的。。
但是显示不出来字段值。。。

这个要怎么做。。告诉我下详细步骤吧。。

谢谢大家的指导。。。。

---------------------
补充

不是的。。。是取combobox1的值(已连接数据库Flash表,Flashname字段),根据Flashname的字段值显示所有相关的Flashname值(也就是combobox1)的值。

如下
若combobox1的值为'超级游戏'

在Flash表Flashname里查找‘超级游戏’的值,如果有
则显示超级游戏的所有信息。。。。
游戏:超级游戏(edit1.text)
类型:飞行(edit2.text)
大小:100Kb(edit3.text)

实在抱歉,表达能力有点差。。。呵呵

有点不太明白,你是想把adoquery1中flashname字段的值自动赋给combobox1吧?
定义一个变量:var i:integer;

combobox1.clear;
adoquery1.first;
if combobox1.items.indexof(adoquery1.fieldvalues['flashname']) then //此处为避免combobox1中出现重复
begin
for i:=0 to adoquery1.recordcount-1 do
begin
combobox1.items.add(adoquery1.fieldvalues['flashname']);
adoquery1.next;
end;
end;
combobox1.text:=combobox1.items[0];让text中显示第一个值.