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)"错误了??? 在线等~~~~~~~~~~~~~~
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)"错误了??? 在线等~~~~~~~~~~~~~~
解决方案 »
- 在一群数值中,取出现次数最多的数值, 求算法。
- TGraphicControl 类闪烁的问题!
- ?????types of actual and formal var parameters must be identical
- 求100以内素数的算法
- 出现"List index out of bounds(-1)"错误?
- 已经是最后43分了,散完我就变成0分了,UP者接分
- FastReport预览的奇怪问题
- 散分!!!原因有两个~~!!!
- 急急急!!!十万火急!dbExpress 怎样连接 SQL Server 不能用 ODBC 吗?
- 巨简单问题,10分钟内回答加分
- 这样的SQL语句怎么写?急
- 我用Delphi想做关于数据库(Oracle)的Web应用,查了下资料,WebBroker,Websnap,IntraWeb都可以实现,不知用什么好?哪位能详细说明一下
------------->>>>>>>>>>>>>>>>>>>>>>>.
for i:=ListBox3.Count-1 downto 0 do
就OK了。
换成for i:=ListBox3.Count-1 downto 0 do就可以了吗?