被 listbox整瓜了???help??help???
procedure TForm5.Button1Click(Sender: TObject);
var
i:integer;
begin
for i:=0 to listbox3.Count -1 do
if listbox3.Selected[i] then
begin
adoquery3.SQL.Clear ;
adoquery3.Close ;
adoquery3.Connection :=adoconnection1;
adoquery3.SQL.Add('select * from userspriv where privid="'+edit4.Text+'" and usersid="'+edit2.text+'"');
adoquery3.Open ;
if adoquery3.eof then
begin
listbox2.Items.Add(listbox3.Items[i]);
listbox3.DeleteSelected ;
adoquery3.sql.Clear ;
adoquery3.Close ;
adoquery3.Connection :=adoconnection1;
adoquery3.SQL.Add('insert into userspriv(usersid,privid,privname) values("'+edit2.text+'","'+edit4.text+'","'+edit3.text+'")');
adoquery3.ExecSQL ;
end;
if listbox3.Items.text='' then
begin
button3.Enabled :=false;
end;
end;
end;
请各位大虾帮忙为什么总是提示"list index out of bounds(2)"错误了???
在线等~~~~~~~~~~~~~~