dao update适用于除一条记录以外的所有记录? [英] dao update works on all but one record?

查看:42
本文介绍了dao update适用于除一条记录以外的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

vb6,dao,mdb,win2k(无权访问)

db.Execute" Update" &安培; TABLE_NAME& "设置fldMark ='''未分配''"


i认为会更新表中的所有记录

它更新了除了一个

读回来我用过

" SELECT< fldlistFROM" &安培; TABLE_NAME& "在哪里FLDMARK<''未分配''

ORDER BY< fldlist>"


结果:

答:1 :0:24:1NA:>>>>><<<<<<<<这是fldMark


它应该没有返回任何记录

所以只有一个更新,如果我读它们都是正确的除了

这一个


有没有办法知道在所有记录更新期间跳过了一条记录?

a方式获取错误代码更新?


对这将如何发生的任何想法?


谢谢

Mark

vb6, dao, mdb, win2k (no access)

db.Execute "Update " & TABLE_NAME & " Set fldMark = ''unassigned''"

i thought that would update all records in table
it updated all but one

to read them back i used
"SELECT <fldlistFROM " & TABLE_NAME & " WHERE FLDMARK <''unassigned''
ORDER BY <fldlist>"

result:
A : 1 : 0 : 24 : 1NA : >>>>2 <<<<<< this is fldMark

it should have returned no records
so all but one were updated, if i read them all they are correct except for
this one

is there a way to know a record was skipped during an update on all records?
a way to get error codes during an update?

any thoughts on how this would occur?

thanks
Mark

推荐答案

" MP" < No **** @ Thanks.comwrote in

news:45 *********************** @ news.nationwide .net:
"MP" <No****@Thanks.comwrote in
news:45***********************@news.nationwide.net :

vb6,dao,mdb,win2k(无访问权限)

db.Execute" Update" &安培; TABLE_NAME& "设置fldMark ='''未分配''"


i认为会更新表中的所有记录

它更新了除了一个

读回来我用过

" SELECT< fldlistFROM" &安培; TABLE_NAME& "在哪里FLDMARK<>

''未分配''ORDER BY< fldlist>"


结果:

A :1:0:24:1NA:>>>>><<<<<<<<这是fldMark


它应该没有返回任何记录

所以只有一个更新,如果我读它们都是正确的

除了这一个


有没有办法知道在所有

记录的更新过程中记录被跳过?一种在更新过程中获取错误代码的方法吗?


对这将如何发生的任何想法?


感谢

标记
vb6, dao, mdb, win2k (no access)

db.Execute "Update " & TABLE_NAME & " Set fldMark = ''unassigned''"

i thought that would update all records in table
it updated all but one

to read them back i used
"SELECT <fldlistFROM " & TABLE_NAME & " WHERE FLDMARK <>
''unassigned'' ORDER BY <fldlist>"

result:
A : 1 : 0 : 24 : 1NA : >>>>2 <<<<<< this is fldMark

it should have returned no records
so all but one were updated, if i read them all they are correct
except for this one

is there a way to know a record was skipped during an update on all
records? a way to get error codes during an update?

any thoughts on how this would occur?

thanks
Mark



如果没有测试我猜想如果表格中存在唯一的复合(多字段)索引,则会发生这种情况其中包括fldMark和

更新该特定记录会导致所涉及字段的值的非唯一

组合。


-

Lyle Fairfield

Without testing I would conjecture that this would occur if there exists on
the table a unique compound(multi-field) index which includes fldMark and
updating that particular record would have resulted in a non-unique
combination of values for the fields involved.

--
Lyle Fairfield


MP写道:
MP wrote:

任何想法如何发生这种情况?
any thoughts on how this would occur?



如果在更新时锁定该记录或违反了

约束,则不会更新。并且它可能已使用未分配更新但是

被改为2。在回读代码执行之前的另一个进程。


It won''t update if that record is locked at the time of the update or if a
constraint is violated. And it might have been updated with "unassigned" but
was changed to "2" by another process before your readback code executed.


是否有办法知道在更新所有记录时是否跳过了记录?

a在更新期间获取错误代码的方法?
is there a way to know a record was skipped during an update on all records?
a way to get error codes during an update?



您应该使用错误处理来告诉您代码何时失败,以便您知道

为什么会出现问题。更新

查询失败(然后回滚事务)时调用错误处理程序的语法是:


db.Execute" Update" ; &安培; TABLE_NAME& "设置fldMark =''未分配''",

dbFailOnError


您还可以检查数据库对象的RecordsAffected属性以显示

计算更新了多少条记录。


-

通过AccessMonster.com发布消息
http://www.accessmonster.com/Uwe/For ... ccess / 200610/1

You should use error handling to tell you when the code fails so you''ll know
why something failed. The syntax to call the error handler when the update
query fails (and then rolls back the transaction) is this:

db.Execute "Update " & TABLE_NAME & " Set fldMark = ''unassigned''",
dbFailOnError

You can also check the database object''s RecordsAffected property to show a
count of how many records were updated.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1


" MP" < No **** @ Thanks.comwrote in

news:45 *********************** @ news.nationwide .net:
"MP" <No****@Thanks.comwrote in
news:45***********************@news.nationwide.net :

vb6,dao,mdb,win2k(无访问权限)

db.Execute" Update" &安培; TABLE_NAME& "设置fldMark ='''未分配''"


i认为会更新表中的所有记录

它更新了除了一个

读回来我用过

" SELECT< fldlistFROM" &安培; TABLE_NAME& "在哪里FLDMARK<>

''未分配''ORDER BY< fldlist>"


结果:

A :1:0:24:1NA:>>>>><<<<<<<<这是fldMark


它应该没有返回任何记录

所以只有一个更新,如果我读它们都是正确的

除了这一个


有没有办法知道在所有

记录的更新过程中记录被跳过?一种在更新过程中获取错误代码的方法吗?


对这将如何发生的任何想法?


感谢

Mark
vb6, dao, mdb, win2k (no access)

db.Execute "Update " & TABLE_NAME & " Set fldMark = ''unassigned''"

i thought that would update all records in table
it updated all but one

to read them back i used
"SELECT <fldlistFROM " & TABLE_NAME & " WHERE FLDMARK <>
''unassigned'' ORDER BY <fldlist>"

result:
A : 1 : 0 : 24 : 1NA : >>>>2 <<<<<< this is fldMark

it should have returned no records
so all but one were updated, if i read them all they are correct
except for this one

is there a way to know a record was skipped during an update on all
records? a way to get error codes during an update?

any thoughts on how this would occur?

thanks
Mark



DAO是否弹出错误对话框?也许有一些选项参数,例如你可以包含的
dbFailOnError会导致这种情况发生。 (如果

你不在Access中,你可能不得不使用文字和& H80,因为

dbFailOnError,我不确定。)


您是否在ADO中尝试过? ADO是否弹出错误对话框?


-

Lyle Fairfield

Did DAO pop up an error dialog? Perhaps there are option parameters such
dbFailOnError that you can include which will result in that happening. (If
you''re not in Access you might have to use a literal, &H80, for
dbFailOnError, I''m not sure.)

Did you try it in ADO? Did ADO pop up an error dialog?

--
Lyle Fairfield


这篇关于dao update适用于除一条记录以外的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆