求助,adoQuery 更新数据表出现 Access violation at address 1F453E63 in module 'msado15.dll'

  • 主题发起人 主题发起人 ff_ff
  • 开始时间 开始时间
F

ff_ff

Unregistered / Unconfirmed
GUEST, unregistred user!
求助,adoQuery 更新数据表出现 Access violation at address 1F453E63 in module 'msado15.dll' 错误(50分)<br />代码如下:
procedure TForm1.Button2Click(Sender: TObject);

var
i:Integer;
sqlstr : String;
begin
if ListBox_Showfix.Items.Strings[ListBox_Showfix.itemindex]&lt;&gt;'' then
begin
with query1 do
begin
close;
sql.clear;
sqlstr := 'update filefix set record=''1'' where filefix.fix='''+getvalue+''' ';
showmessage(sqlstr);
sql.add(sqlstr);
ExecSQL;
end;
ListBox1.Items.Insert(0,ListBox_Showfix.Items.Strings);
ListBox_Showfix.Items.Delete(i);
end;

end;

sqlstr放在access中执行 没有错误。
 
我以前也经常会发现这样的提示信息,很迷惑人,因为无法确定问题的原因,
后来查找一个看,主要是程序代码不良或系统开销太大引起的,你换一种方式试验
一下看看,同时也看一下此时系统资源还有多少,如果剩余的系统资源太少,也是会出现问题的.
 
ListBox1.Items.Insert(0,ListBox_Showfix.Items.Strings);
ListBox_Showfix.Items.Delete(i);
这两条语句中的“i”的值是哪里来的?没有赋值过,肯定会有Access Violation错误的
 
我试过如果不加入sql语句的话是可以正常运行的。只不过程序提示i没有初始化。此代码的作用是将一个listbox中的条目转移到另一个listbox中,同时将与条目相对应的record的值置1。
 
1.query1是否正常,连接是否正确
2.你直接写一个简单的查询或者更新语句试一下,看看是否语句的问题
3.是否系统文件错误:msado15.dll
另外我想请教一下你是怎么发信息给我的
 
代码本身应该没有问题的。你试试下面的代码。
begin
if ListBox_Showfix.Items.Strings[ListBox_Showfix.itemindex]&lt;&gt;'' then
begin
query1.close;
query1.sql.text:='update filefix set record=''1'' where filefix.fix='''+getvalue+''' ';
query1.ExecSQL;
end;
end;
 
to dey-999 页面上有在线大富翁,其中有一个像闪电的图标,用鼠标点击就是发送信息给在线大富翁。[:D]
 
你是通过ADO来连接ODBC数据源吧

如果是SQL SERVER数据库,你可以打补丁解决这问题。

也可以不通过ODBC连接来解决这问题。
 
应该是这样的.
procedure TForm1.Button2Click(Sender: TObject);

var
i:Integer;
begin
for i:=ListBox_Showfix.Items.Count-1 downTo 0 do
begin
if ListBox_Showfix.Selected then
begin
query1.close;
query1.sql.text:='update filefix set record=''1'' where filefix.fix='''+getvalue+''' ';
query1.ExecSQL;
ListBox1.Items.Insert(0,ListBox_Showfix.Items.Strings);
ListBox_Showfix.Items.Delete(i);
end;
end;
end;
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
915
import
I
S
回复
0
查看
952
SUNSTONE的Delphi笔记
S
I
回复
0
查看
822
import
I
后退
顶部