function调用及定义如下:
sql:='Select kt_ID,kt_name From tblSubject';
captionFieldName:='kt_name';
valueFieldName:='kt_ID';
noAsFirst:=True;
if not FillInComBoBoxWithAdoQuery(Query1;ComboBox1;sql;captionFieldName;valueFieldName;noAsFirst) then
begin
ShowMessage('数据库连接错误');
end;
function函数:
function FillInComBoBoxWithAdoQuery(objAdoQuery:TAdoQuery;objComBoBox:TComboBox;sql:string;captionFieldName:string;valueFieldName:string;noAsFirst:boolean):boolean;
sql:='Select kt_ID,kt_name From tblSubject';
captionFieldName:='kt_name';
valueFieldName:='kt_ID';
noAsFirst:=True;
if not FillInComBoBoxWithAdoQuery(Query1;ComboBox1;sql;captionFieldName;valueFieldName;noAsFirst) then
begin
ShowMessage('数据库连接错误');
end;
function函数:
function FillInComBoBoxWithAdoQuery(objAdoQuery:TAdoQuery;objComBoBox:TComboBox;sql:string;captionFieldName:string;valueFieldName:string;noAsFirst:boolean):boolean;
会不会你的定义跟实现不一样的啊!
你在[]if not FillInComBoBoxWithAdoQuery],按住Ctrl键,左键单击FillInComBoBoxWithAdoQuery,看看定义的参数个数是多少!