Y
ywan
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大哥好,小弟在写用数组函数从数据表表中取出函数遇到一些问题,请指教!
具体程序如下:
//从数据表中获得数据,并存进数组
Function GetDatas( GField : Array of string ; DBName : string; Range :string) : string;
var
SQLString :string;
i,j,k :integer;
LSQLString : integer;
Datas : array of string;
begin
for i:=0 to high(Gfield) do
begin
SQLString := SQLString + GField + ' , ';
end;
LSQLString := length(SQLString)-3;
SQlString := copy( SQLString ,0, LSQLString);
SQLString:='select ' +SQLString + ' From ' + DBName + ' '+ Range;
with Aquery do
begin
close;
sql.clear;
sql.add(sqlstring);
open;
k:=0;
while not eof do
begin
for j:=0 to Fieldcount-1 do
begin
Datas[k][j]:=fields[j].asstring;
end;
k:=k+1;
end;
result := Datas[k][j];
end;
end;
出现错误如下:
[Error] fun.pas(145): Incompatible types: 'Char' and 'String'
具体程序如下:
//从数据表中获得数据,并存进数组
Function GetDatas( GField : Array of string ; DBName : string; Range :string) : string;
var
SQLString :string;
i,j,k :integer;
LSQLString : integer;
Datas : array of string;
begin
for i:=0 to high(Gfield) do
begin
SQLString := SQLString + GField + ' , ';
end;
LSQLString := length(SQLString)-3;
SQlString := copy( SQLString ,0, LSQLString);
SQLString:='select ' +SQLString + ' From ' + DBName + ' '+ Range;
with Aquery do
begin
close;
sql.clear;
sql.add(sqlstring);
open;
k:=0;
while not eof do
begin
for j:=0 to Fieldcount-1 do
begin
Datas[k][j]:=fields[j].asstring;
end;
k:=k+1;
end;
result := Datas[k][j];
end;
end;
出现错误如下:
[Error] fun.pas(145): Incompatible types: 'Char' and 'String'