Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / May 2007



Tip: Looking for answers? Try searching our database.

Multiple-step operation error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vovan - 30 May 2007 18:52 GMT
I need to update the column value in many rows in SQL Server 2000 table.
I'm creating ADODB.Recordset, poulating it with data by using "SELECT
Balance FROM CheckRegister WHERE AccountID = " & lngAccountID

When I try to set a new value to Balance in the recordset I get an error
Multiple-step operation error.
The recordset has many records in this case
If I change where clause to WHERE RecordID = 1, for instance, I do not get
any error. I suspect that my problem is related to the fact I select a bunch
of records in the first case and only one single record in the second case.

So, how can I populate a recordset from one single table, assign new values
to its fields in different rows (by using MoveNext, Find etc) and finally
save data back to the table using Update method of the recordset?

Thank you

vovan
Jeff Johnson - 30 May 2007 20:34 GMT
>I need to update the column value in many rows in SQL Server 2000 table.
> I'm creating ADODB.Recordset, poulating it with data by using "SELECT
[quoted text clipped - 11 lines]
> values to its fields in different rows (by using MoveNext, Find etc) and
> finally save data back to the table using Update method of the recordset?

Show us your code.
vovan - 30 May 2007 22:16 GMT
I decided to change the approach for an update.
I make selection including ID of the record, then I'm looping through the
recordset and execute ADODB.Command wich updates the record in the table
with the ID related to ID in the recordset.
It works, so I give up my previous attempt to update the table through
recordset

Thank you
vovan

>>I need to update the column value in many rows in SQL Server 2000 table.
>> I'm creating ADODB.Recordset, poulating it with data by using "SELECT
[quoted text clipped - 13 lines]
>
> Show us your code.
Robert Morley - 30 May 2007 23:51 GMT
Glad to hear that it's working.  Frequently, things like this will happen as
a result of updating more than one field, where one of the updates gets
rejected by the back-end for some reason, such as integrity violations,
triggers that raise an error, etc.  That's usually where you want to look
when you get a "multiple-step" error.

Rob

>I decided to change the approach for an update.
> I make selection including ID of the record, then I'm looping through the
[quoted text clipped - 24 lines]
>>
>> Show us your code.
MikeD - 31 May 2007 02:28 GMT
> Glad to hear that it's working.  Frequently, things like this will happen
> as a result of updating more than one field, where one of the updates gets
> rejected by the back-end for some reason, such as integrity violations,
> triggers that raise an error, etc.  That's usually where you want to look
> when you get a "multiple-step" error.

Huh. I never use data controls or data-binding and instead either write SQL
or call stored procedures. I've NEVER gotten that particular error before.
Is it specific to "data-binding" or updating via a Recordset object (IOW,
using the Update method)?

Signature

Mike
Microsoft MVP Visual Basic

Steve Gerrard - 31 May 2007 03:26 GMT
> Huh. I never use data controls or data-binding and instead either write SQL or
> call stored procedures. I've NEVER gotten that particular error before. Is it
> specific to "data-binding" or updating via a Recordset object (IOW, using the
> Update method)?

The "multiple-step error" message is from ADO when using a recordset, but it is
usually based on an error at the database end of things. The most common one I
have encountered is a string value longer than the field length. If you got into
the ado errors collection, etc., you could see the actual db server error
messages.
Ralph - 31 May 2007 03:59 GMT
> > Glad to hear that it's working.  Frequently, things like this will happen
> > as a result of updating more than one field, where one of the updates gets
[quoted text clipped - 6 lines]
> Is it specific to "data-binding" or updating via a Recordset object (IOW,
> using the Update method)?

It is not confined to "data-binding" or the .Update method. Although it is
obviously confined to "action" queries. It's one of those error messages
that only a database guru (a specialist in internal micro-coding) can
appreciate. <g> Very important to catch the error description (it can vary)
and enumerate the error collections. Subsequent messages are usually more
informative. (as Steve noted)

It can be caused by any number of things. Attempting to update a field that
doesn't accept nulls, trying to input more characters than allowed, a string
instead of a number, etc. Plus everything Robert mentioned.

It is encountered by a programmer most often with the .Update method because
it is here that something unintended or unexpected is most likely to happen.
The .Update method uses a query that is built from the library's best guess
on what is to be updated. Lots of opportunities for error.

hth
-ralph
Robert Morley - 31 May 2007 04:09 GMT
Yeah, what they said. :)

Rob

>> Glad to hear that it's working.  Frequently, things like this will happen
>> as a result of updating more than one field, where one of the updates
[quoted text clipped - 6 lines]
> before. Is it specific to "data-binding" or updating via a Recordset
> object (IOW, using the Update method)?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.