我建立了一个‘部门‘数据库,在一个form中用dbcombobox空件来选择该数据库中部门,为何datasource是空白的,无法选择

解决方案 »

  1.   

    叙述的也太简单了吧?数据源都设定好了么?active设定为真了么?把代码帖上来才有人帮你看那
      

  2.   

    unit Unit2;{建立数据模块}interfaceuses
      SysUtils, Classes, DBTables, DB;type
      TDataModule2 = class(TDataModule)
        bumentable: TTable;
        gongzhongtable: TTable;
        laobaoTable: TTable;
        lingyongTable: TTable;
        renyuanTable: TTable;
        bumentableDS: TDataSource;
        gongzhongDS: TDataSource;
        laobaoDS: TDataSource;
        lingyongDS: TDataSource;
        renyuanDS: TDataSource;
        queryDS: TDataSource;
        Query1: TQuery;
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      DataModule2: TDataModule2;implementation{$R *.dfm}end.unit Unit3;{调用模块}interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ComCtrls, DBCtrls, Grids, DBGrids, Buttons;type
      Tform3 = class(TForm)
        PageControl1: TPageControl;
        TabSheet1: TTabSheet;
        TabSheet2: TTabSheet;
        TabSheet3: TTabSheet;
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        Edit2: TEdit;
        Label3: TLabel;
        ComboBox1: TComboBox;
        DBComboBox1: TDBComboBox;
        Label4: TLabel;
        Label5: TLabel;
        Label6: TLabel;
        Label7: TLabel;
        Label8: TLabel;
        DBComboBox2: TDBComboBox;
        DBComboBox3: TDBComboBox;
        DBComboBox4: TDBComboBox;
        DBComboBox5: TDBComboBox;
        BitBtn1: TBitBtn;
        BitBtn2: TBitBtn;
        DBGrid1: TDBGrid;
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure PageControl1Change(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      form3: Tform3;implementation{$R *.dfm}
    procedure Tform3.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    action:=cafree;
    end;procedure Tform3.PageControl1Change(Sender: TObject);
    beginend;end.