部门表结构如下
'SELECT [fID]
,[fParentID]
,[fParentCode]
,[fCode]
,[fName]
,[fDeptManager]
,[fAddress]
,[fTel]
,[fFax]
,[fEmail]
,[fStatus]
,[fNotes]
FROM [ClothU].[base].[tdepartment]'
员工类型表结构 如下
SELECT [fID]
,[fName]
,[fNotes]
,[fFlag]
FROM [ClothU].[base].[tEType]
代码如下
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 433
ClientWidth = 837
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object cxDBLookupComboBox1: TcxDBLookupComboBox
Left = 536
Top = 32
DataBinding.DataField = 'fTypeID'
DataBinding.DataSource = DataSource2 {这是保存数据的地方}
Properties.KeyFieldNames = 'fID'
Properties.ListColumns = <
item
FieldName = 'fName' {这是在列表中显示数据的项和标题,即下拉列表}
end>
Properties.ListSource = DataSource1 {这是在列表中显示数据的数据源}
TabOrder = 0
Width = 145
end
object DBGrid1: TDBGrid
Left = 0
Top = 0
Width = 513
Height = 433
Align = alLeft
DataSource = DataSource2
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
end
object ClothuConnection: TFDConnection
Params.Strings = (
'ConnectionDef=ClothU')
Connected = True
LoginPrompt = False
Left = 650
Top = 63
end
object TetypeTable: TFDQuery
Active = True
Connection = ClothuConnection
SQL.Strings = (
'SELECT * FROM base.tEType')
Left = 674
Top = 103
end
object DataSource1: TDataSource
DataSet = TetypeTable
Left = 696
Top = 152
end
object TemployeeTable: TFDQuery
Active = True
Connection = ClothuConnection
SQL.Strings = (
'SELECT * FROM ClothU.base.tEmployee')
Left = 184
Top = 30
end
object DataSource2: TDataSource
DataSet = TemployeeTable
Left = 184
Top = 88
end
end
{仅当笔记}