ITPub博客

首页 > 数据库 > 数据库开发技术 > TBComboBoxEh 下拉列表框數據表列資料

TBComboBoxEh 下拉列表框數據表列資料

原创 数据库开发技术 作者:zaorv 时间:2019-03-23 12:48:05 0 删除 编辑

// TBComboBoxEh 下拉列表框,加載數據庫的選擇資料。

// 通用 過程

// 調用方式:

//procedure Tfrm_makep.FormCreate(Sender: TObject);
// begin

// AddComBoxStr(qry_sel,'YPSZ',DBComboBoxEh7);

// END;

procedure AddComBoxStr(vTableName,vType: string;vComBox: TDBComboBoxEh);//解決小廖的ComBox問題
var
lClientDataSet: TClientDataSet;
li: integer;
begin
lClientDataSet := GetTmpDataSet(0);
lClientDataSet.Close;
lClientDataSet.CommandText := 'select id,mc from t_combo where app_id='+#39+vTableName+#39+
' and lb='+#39+vType+#39;
lClientDataSet.Active := True;
if lClientDataSet.RecordCount > 0 then
for li := 0 to lClientDataSet.RecordCount - 1 do
begin
vComBox.Items.Add(lClientDataSet.FieldByName('id').AsString + '】' + lClientDataSet.FieldByName('mc').AsString);
lClientDataSet.Next;
end;
lClientDataSet.Close;
end;

// DELPHI 7

//來源: 來源於網絡

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/729024/viewspace-1060236/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-12

  • 博文量
    192
  • 访问量
    206110