我写了这样一个Function
已经在Form上放了 adoconnection1, adoquery1 和 combobox1;Function Rcount(str1: string; str2: string): integer;
var sql: string;
i: integer;
begin
sql:='select * from db1 where id>'+ str1;
adoquery1.SQL.Text:=sql
adoquery1.Open;
for i:=1 to adoquery1.RecordCount do
begin
combobox1.Items.Add(adoquery1.FieldValues['id'] );
adoquery1.Next;
end;
Rcount:= adoquery1.RecordCount;
end;
但编译时出错,说我的adoquery1 和 combobox1没有定义;
如果我重新定义的话,那么原先放上form的adoquery1 和 combobox1的设置不就没有意义
了吗?
用 var 来定义,但也出错;
求教应该怎样定义啊?!!!!!
已经在Form上放了 adoconnection1, adoquery1 和 combobox1;Function Rcount(str1: string; str2: string): integer;
var sql: string;
i: integer;
begin
sql:='select * from db1 where id>'+ str1;
adoquery1.SQL.Text:=sql
adoquery1.Open;
for i:=1 to adoquery1.RecordCount do
begin
combobox1.Items.Add(adoquery1.FieldValues['id'] );
adoquery1.Next;
end;
Rcount:= adoquery1.RecordCount;
end;
但编译时出错,说我的adoquery1 和 combobox1没有定义;
如果我重新定义的话,那么原先放上form的adoquery1 和 combobox1的设置不就没有意义
了吗?
用 var 来定义,但也出错;
求教应该怎样定义啊?!!!!!
Function Rcount(str1: string; str2: string): integer;实现部分应该是
Function TForm1.Rcount(str1: string; str2: string): integer;应该就可以了...