没
没救_delphi
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大虾,我的程序这部分有问题,该怎样实现联合查询的功能呢?
procedure TFrmchracter.DBListBox1DblClick(Sender: TObject);
var values:string;
begin
for i:=0 to DBListbox1.items.count-1 do
if DBListbox1.selected then//如果DBListbox1的元素被选择
begin
values:=DBListbox1.Items;
ADOQuery1.Close;
//查询这所班级的所有学生姓名
ADOQuery1.SQL.Add('select 学生姓名 from 班级 where 班级序号=(select 班级序号 from 学校 where 班级名称='+values+''));//这条语句有问题,但是不知道怎么才能实现
ADOQuery1.Open;
end;
//在DBListbox2中显示选择班级的所有学生姓名
for i:=0 to ADOQuery1.recordcount-1 do
with DBListbox2.items do
begin
close;
add();
end;
end;
procedure TFrmchracter.DBListBox1DblClick(Sender: TObject);
var values:string;
begin
for i:=0 to DBListbox1.items.count-1 do
if DBListbox1.selected then//如果DBListbox1的元素被选择
begin
values:=DBListbox1.Items;
ADOQuery1.Close;
//查询这所班级的所有学生姓名
ADOQuery1.SQL.Add('select 学生姓名 from 班级 where 班级序号=(select 班级序号 from 学校 where 班级名称='+values+''));//这条语句有问题,但是不知道怎么才能实现
ADOQuery1.Open;
end;
//在DBListbox2中显示选择班级的所有学生姓名
for i:=0 to ADOQuery1.recordcount-1 do
with DBListbox2.items do
begin
close;
add();
end;
end;