A
asdfg1234
Unregistered / Unconfirmed
GUEST, unregistred user!
var
slAll,slLine: TStringList;
i: Integer;
begin
// OpenDialog1.Execute;
slAll := TStringList.Create;
slLine := TStringList.Create;
slAll.LoadFromFile('e:/aaa.txt');
for i := 0 to slAll.Count-1 do
begin
slLine.Delimiter := ' ';
slLine.DelimitedText := slAll.Strings;
AdoCommand1.CommandText:='insert into ydfmx_tc (ac,tc) values ('+quotedstr(slLine.Strings[0])+','+quotedstr(slLine.Strings[1])+')';
AdoCommand1.Execute;
end;
slAll.Free;
slLine.Free;
end;
文本文件尾部有空行,导入sql时提示list index out of bounds(0),如何处理.
slAll,slLine: TStringList;
i: Integer;
begin
// OpenDialog1.Execute;
slAll := TStringList.Create;
slLine := TStringList.Create;
slAll.LoadFromFile('e:/aaa.txt');
for i := 0 to slAll.Count-1 do
begin
slLine.Delimiter := ' ';
slLine.DelimitedText := slAll.Strings;
AdoCommand1.CommandText:='insert into ydfmx_tc (ac,tc) values ('+quotedstr(slLine.Strings[0])+','+quotedstr(slLine.Strings[1])+')';
AdoCommand1.Execute;
end;
slAll.Free;
slLine.Free;
end;
文本文件尾部有空行,导入sql时提示list index out of bounds(0),如何处理.