有没有一个语句把adoquery查询到的数据一次性全赋值给listbox控件或别的string变量?
顺便再问一个,
用什么语句判断listbox中N行数据中有没有一行包含str字符串??
顺便再问一个,
用什么语句判断listbox中N行数据中有没有一行包含str字符串??
解决方案 »
- DBChart使用问题
- 请教LockWindowUpdate()这个函数怎么用呀?
- 怎样按层遍历TreeView?
- 有关读取指定的字符的问题!
- 谁能提供一份将*.emf图形格式文件转成*.tiff的源码或者控件?(解决立即放分100!!!)
- 纪念光棍两周年,特此散分!!!
- 针对DBNavigator的点击事件如何编程呢
- dbgrid高级编程问题: dbgrid 实现类似stringgrid控件的功能,难!难!难!超难难难难难难难难难!
- 一个学过OOA/OOD, UML,Design Pattern, C++, JAVA(一点点),DEPHIL的家伙,该如何继续前进呢?
- 请问如何使Delphi中主窗体Form的右上角的关闭按钮为虚显示?
- 禁止鼠标对窗体左右下的边拉伸和收缩是FORM的那个属性?
- 高手`出招
如果用ListBox的话,只有写代码了..也就几行吧.
with AdoQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select xName from Table1 where ...');
Open;
if not IsEmpty then
while not eof do
begin
ListBox1.Items.Add(FieldByName('xName').AsString);
Next;
end;
end;
至于判断listbox中N行数据中有没有一行包含str字符串??
var
str:string;
i:integer;
begin
i:=0;
str:='ice';
with ListBox1 do
begin
while i<Items.Count do
begin
if AnsiContainsStr(ListBox1.Items.Strings[i], str) then
ShowMessage('第'+inttostr(i+1)+'行 包含str字符串!');
i:=i+1;
end;
end;
end;这样试试
with AdoQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('select xName from Table1 where ...');
Open;
if not IsEmpty then
while not eof do
begin
ListBox1.Items.Add(FieldByName('xName').AsString);
Next;
end;
end;