M
mxq888
Unregistered / Unconfirmed
GUEST, unregistred user!
有这个一个函数:
function GenkDataSL(kjfilename: string): TstringList;//返回一个TstringList
var f: textfile;
begin
result := TstringList.Create;///////////
Table1 := TTable.Create(nil);
Table1.TableName := kjfilename;
Table1.Active := true;
if table1.RecordCount = 0 then exit;
Table1.DisableControls;
Table1.First;
with Table1 do
begin
for j := 0 to RecordCount - 1 do
begin
temp := '';
for i := 0 to FieldCount - 1 do
begin
temp := temp + fields.asstring;
temp := temp + ' ';
end;
result.Add(temp);///此处添加数据,调试时知道此处已加入数据了/////////////
Table1.Next;
end;
Table1.Free;
end;
end;
然后在调用时,我又创建了个Tstringlist:
glzh:=TstringList.Create;
glzh:=GenkDataSL(fname);
i:=0;
i:=glzh.Count; //此时i=6460876,不知为什么?我这样调用不对吗???谢谢
function GenkDataSL(kjfilename: string): TstringList;//返回一个TstringList
var f: textfile;
begin
result := TstringList.Create;///////////
Table1 := TTable.Create(nil);
Table1.TableName := kjfilename;
Table1.Active := true;
if table1.RecordCount = 0 then exit;
Table1.DisableControls;
Table1.First;
with Table1 do
begin
for j := 0 to RecordCount - 1 do
begin
temp := '';
for i := 0 to FieldCount - 1 do
begin
temp := temp + fields.asstring;
temp := temp + ' ';
end;
result.Add(temp);///此处添加数据,调试时知道此处已加入数据了/////////////
Table1.Next;
end;
Table1.Free;
end;
end;
然后在调用时,我又创建了个Tstringlist:
glzh:=TstringList.Create;
glzh:=GenkDataSL(fname);
i:=0;
i:=glzh.Count; //此时i=6460876,不知为什么?我这样调用不对吗???谢谢