G
gadfly
Unregistered / Unconfirmed
GUEST, unregistred user!
要有选择性得将数据表中的数据放到报表中,我怎么建个临时性的表,将符合纪录的数据
一条条的取出来,再显示呢?我这样试了一下,结果不行啊
//Mytable中不存在cardnum=-1的数据
sQuery:='Select * from MyTable Where CardNum=-1';
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(sQuery);
open;
end;
//我这样时出错
ADOTable1.First;
while not ADOTable1.Eof do
begin
ADOQuery1.Insert;
ADOQuery1.FieldByName('CardNum').Value:=ADOTable1.FieldByName('CardNum').Value;
ADOQuery1.FieldByName('UserName').Value:=ADOTable1.FieldByName('UserName').Value; ADOQuery1.FieldByName('CardNum').Value:=ADOTable1.FieldByName('CardNum').Value;
ADOQuery1.FieldByName('DepartNum').Value:=ADOTable1.FieldByName('DepartNum').Value;
ADOQuery1.Post;
ADOTable1.Next;
end;
请搞手指教!
一条条的取出来,再显示呢?我这样试了一下,结果不行啊
//Mytable中不存在cardnum=-1的数据
sQuery:='Select * from MyTable Where CardNum=-1';
with ADOQuery1 do
begin
Close;
sql.Clear;
sql.Add(sQuery);
open;
end;
//我这样时出错
ADOTable1.First;
while not ADOTable1.Eof do
begin
ADOQuery1.Insert;
ADOQuery1.FieldByName('CardNum').Value:=ADOTable1.FieldByName('CardNum').Value;
ADOQuery1.FieldByName('UserName').Value:=ADOTable1.FieldByName('UserName').Value; ADOQuery1.FieldByName('CardNum').Value:=ADOTable1.FieldByName('CardNum').Value;
ADOQuery1.FieldByName('DepartNum').Value:=ADOTable1.FieldByName('DepartNum').Value;
ADOQuery1.Post;
ADOTable1.Next;
end;
请搞手指教!