cxDBLookupComboBox 使用入门

部门表结构如下

'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

 

{仅当笔记}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值