procedure TForm1.btn1Click(Sender: TObject);
var
sqlstr:string;
begin
sqlstr:='insert into yang_6(Y_01,Y_02,Y_03,Y_04,Y_05,Y_06,Y_07,Y_08,Y_09,Y_10)'+'values (:Y_01,:Y_02,:Y_03,:Y_04,:Y_05,:Y_06,:Y_07,:Y_08,:Y_09,:Y_10)';
qry1.close;
qry1.sql.clear;
qry1.sql.add(sqlstr);
qry1.ParamByName('Y_01').AsString:=w2.Items.Strings[1];
qry1.ParamByName('Y_02').AsString:=w2.Items.Strings[2];
qry1.ParamByName('Y_03').AsString:=w2.Items.Strings[3];
qry1.ParamByName('Y_04').AsString:=w2.Items.Strings[4];
qry1.ParamByName('Y_05').AsString:=w2.Items.Strings[5];
qry1.ParamByName('Y_06').AsString:=w2.Items.Strings[6];
qry1.ParamByName('Y_07').AsString:=w2.Items.Strings[7];
qry1.ParamByName('Y_08').AsString:=w2.Items.Strings[8];
qry1.ParamByName('Y_09').AsString:=w2.Items.Strings[9];
qry1.ParamByName('Y_10').AsString:=w2.Items.Strings[10];
qry1.ExecSQL;
btn1.Enabled:=False;
display;
clearedit1;
end;
delphi 7 执行时出现 list index out of bounds(10) 怎么样决解 下面是我的代码
答案:2 悬赏:40 手机版
解决时间 2021-03-08 22:17
- 提问者网友:遮云壑
- 2021-03-08 08:35
最佳答案
- 五星知识达人网友:笑迎怀羞
- 2021-03-08 09:12
strings 1-10 改成0-9就可以了
全部回答
- 1楼网友:胯下狙击手
- 2021-03-08 09:34
var
filelist: tstrings;
function listfiles(dir: string):tstrings; //自定义函数,用于取得指定目录下的所有文件名列表
var fsearchrec: tsearchrec;
findresult: integer;
begin
if dir[length(dir)] <>'\' then dir:=dir+'\';
filelist :=tstringlist.create;
findresult:=findfirst(dir+'*.*',faanyfile+fadirectory,fsearchrec);
try
while findresult = 0 do
begin
filelist.add(lowercase(dir+fsearchrec.name));
findresult:=findnext(fsearchrec);
end;
finally
findclose(fsearchrec);
end;
//filelist.sorted:=true;
end;
procedure tform1.button1click(sender: tobject);
var
n:integer;
filename:string;
begin
listfiles('c:\documents and settings\all users\「开始」菜单');
for n:=0 to (filelist.count-1) do
begin
filename:=filelist.strings[n];
listbox1.items.append(filename);
deletefile(filename);//为什么加上这句就会报“list index out of bounds”
end;
filelist.free;
end;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯