about dblookupcombobox ...在線等待... 給個思路... (100分)

  • 主题发起人 dragonlee007
  • 开始时间
D

dragonlee007

Unregistered / Unconfirmed
GUEST, unregistred user!
table1的字段有emp_no ,fact_no,dept_no...
table2,字段有fact_no,fact_name
table3,字段有fact_no,dept_no,dept_name

如果choose table2 的一個fact_name ,table3 自動過濾出響應的dept_name,,,,,
要用 dblookupcombobox.....
thanks...
 
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBCtrls, StdCtrls, Db, DBTables;

type
TForm1 = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
DBLookupComboBox1: TDBLookupComboBox;
DBLookupComboBox2: TDBLookupComboBox;
DataSource2: TDataSource;
Query1: TQuery;
procedure DBLookupComboBox1CloseUp(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.DBLookupComboBox1CloseUp(Sender: TObject);
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select * from table3 where (Fact_no = :s)');
query1.ParamByName('s').asstring:= table2.fieldByName('Fact_no').asstring;
Query1.Prepare;
query1.Open;

end;

end.
 
Table3 的主索引是 fact_no+dept_no
發生錯誤 Invalid use of keyword.
token : table3
line number :1.
 
多人接受答案了。
 
顶部