// 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博客 ” ,链接:http://blog.itpub.net/729024/viewspace-1060236/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/729024/viewspace-1060236/