例如:A,B为表able_1中的列名
A B
1 ss
2 ww
5 tt
如何把B列的值一次赋给 delphi 某个程序中已定义的一个数组ARRAY_er , 即 ARRAY_er=ss ww tt
以便在SQL条件
A B
1 ss
2 ww
5 tt
如何把B列的值一次赋给 delphi 某个程序中已定义的一个数组ARRAY_er , 即 ARRAY_er=ss ww tt
以便在SQL条件
调试欢乐多
i := 0;
with Adoquery1 do
begin
close;
sql.clear;
sql.add('select * from table_1');
prepare;
open;
while not eof do
begin
array_er[i] := fieldbyname('B').asstring;
next ;
i := i+1;
end;
end;
var
ARRAY_er :array of string;
i :integer;
begin
i:=0;
with Adoquery1 do
begin
close;
sql.text:='select B from table_1';
open;
if IsEmpty then exit;
SetLength(ARRAY_er, RecordCount);
First;
while not eof do
begin
array_er[i] :=Fields[0].asstring;
{showmessage(array_er[i]); 此句测试用}
next ;
end;
end;
SetLength(ARRAY_er,0);
end;
var
ARRAY_er :array of string;
i :integer;
begin
i:=0;
with Adoquery1 do
begin
close;
sql.text:='select B from table_1';
open;
if IsEmpty then exit;
SetLength(ARRAY_er,RecordCount); {array[0..RecordCount-1]}
First;
while not eof do
begin
array_er[i] :=Fields[0].asstring;
Inc(i);
next ;
{showmessage(array_er[i]); 此句测试用}
end;
end;
{ SetLength(ARRAY_er,0); 释放}
end;