A库用aADOTable,B库用bADOTable,psnameListBox var psNo : Integer;begin aADOTable.First; while not aADOTable.Eof do begin if aADOTable.FieldValues['PSSex'] then begin psNo := aADOTable.FieldValues['PSNO']; if bADOTable.Locate('PSNO',psNo,[loPartialKey]) then psnameListBox.Items.Add(bADOTable.FieldValues['PSName']); end; end; end;
我还有一个非常菜鸟的问题,就是:如何用 ADOTable 打开 D:\A.DBF ?
Query1.Close; Query1.SQL.Text:= 'select PSName from A left join B On(A.PSNO=B.PSNO '+ ' and B.PSSex=''True'''; Query1.Open; Query1.First; ListBox1.Clear; while Not Query1.Eof do begin ListBox1.Items.Add(Query1.Fields[0].AsString); Query1.Next; end;
Query1.Close; Query1.SQL.Text:= 'select PSName from A,b Where A.PSNO=B.PSNO and B.PSSex=1'; Query1.Open; Query1.First; ListBox1.Clear; while Not Query1.Eof do begin ListBox1.Items.Add(Query1.Fields[0].AsString); Query1.Next; end;
var
psNo : Integer;begin
aADOTable.First;
while not aADOTable.Eof do
begin
if aADOTable.FieldValues['PSSex'] then
begin
psNo := aADOTable.FieldValues['PSNO'];
if bADOTable.Locate('PSNO',psNo,[loPartialKey]) then
psnameListBox.Items.Add(bADOTable.FieldValues['PSName']);
end;
end;
end;
Query1.SQL.Text:=
'select PSName from A left join B On(A.PSNO=B.PSNO '+
' and B.PSSex=''True''';
Query1.Open;
Query1.First;
ListBox1.Clear;
while Not Query1.Eof do
begin
ListBox1.Items.Add(Query1.Fields[0].AsString);
Query1.Next;
end;
Query1.SQL.Text:=
'select PSName from A,b Where A.PSNO=B.PSNO and B.PSSex=1';
Query1.Open;
Query1.First;
ListBox1.Clear;
while Not Query1.Eof do
begin
ListBox1.Items.Add(Query1.Fields[0].AsString);
Query1.Next;
end;