adoquery和adostoredproc执行出错(50分)

M

mnmn

Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是sql server 2000,用adoquery或 adostoredproc作了很简单的
select * from rsgz;然后在程序中
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Edit;
adoquery1.FieldByName('编号').asstring:='55-1';
adoquery1.post;

end;
就会报错:‘缺少更新或刷新的键列信息。
 
加主键吧
 
能不能说的详细点?
 
我的数据库都加了主键的,现在用adostoredproc做,发现
adostoredproc.close的时候报错,是:
...raised execption class EOleExecption with message 'BOF 或EOF 中有一个是"真",
或者当前记录已被删除,所需操作要求一个当前纪录。

adostoredproc.refresh的时候报错:‘缺少更新或刷新的键列信息。

那个能帮我解决这个问题?

 
maybe two problem cause it

1. owing to ado's bug in delphi
you have to close adoconnection and re-open it before ado component's
operation.
2. owing to sql server not permit delphi to operate one table in sqlserver
which has no primary key or unique key. you have to create one primary
index to the table.
 
如果你的SQL数据库是新的而且没有任何资料,不要在SQL Server 中设定字段判断条件(Not Null),否则会出现你说的问题。
 
我还是从头说说清楚:
我在SQL SERVER 2000的数据库中设置的‘序号’字段为主键,然后在SQL SERVER 2000中
定义了一个存储过程‘select * from rsgz order by 序号’。
在程序中定义了一个adostoredproc1来调用上面的存储过程。就是在adostoredproc.close
的时候报错:
...raised execption class EOleExecption with message 'BOF 或EOF 中有一个是"真",
或者当前记录已被删除,所需操作要求一个当前纪录。
执行adostoredproc.refresh的时候报错:‘缺少更新或刷新的键列信息。
这到底怎么解决?????
 
这个:
...raised execption class EOleExecption with message 'BOF 或EOF 中有一个是"真",
或者当前记录已被删除,所需操作要求一个当前纪录。
已经解决了。
第二个还没解决
 
我。。。。也想知道,因为我现在也面临一个同样的问题,我觉得是ADO的BUG,(打了补丁
,升级ADO 也没用),我正准备改成用Update语句更新。
祝你好运
 
接受答案了.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
405
import
I
I
回复
0
查看
644
import
I
I
回复
0
查看
493
import
I
顶部