RE: Error message "Row cannot be located for updating"

"Bonnett, John" <[email protected]>
Newsgroups gmane.comp.db.mysql.odbc
Message-ID <[email protected]>
I have to agree completely with Daniel. I find a very simple way of
working with MySQL (and any other SQL database for that matter) is to do
all your input from the database using a read only recordset and all
your output using INSERT, UPDATE and DELETE queries. These facilities
are nearly always available and when errors occur, it is easy to
identify and fix the problem because it will either be in your own code
or in the SQL you wrote.

When you use all the infrastructure of things like ADODB or ADO.NET etc.
problems can be much harder to find, you are also buying into a lot of
stuff you may not need and it may not work with the database you want to
use.

I am in the process of converting a MySQL database application that uses
this approach from VB6 to VB.NET and it seems to be going rather well. I
used VBMySQLDirect in VB6 and have switched to just using
MySqlDataReader and action queries on the VB.NET side. This same app
also needs to access SQL Server databases for some of its data. For that
I can use SqlDataReader and action queries. At this level SQL Server and
MySQL are very similar and I can write a wrapper class over both of them
to hide the different data sources from the rest of the program.

Although you need to write more code using this approach, it is all in
your control and problems are easier to resolve because you van actually
see what is going on.

______________

Carl Zeiss Vision
Computer Scientist
Asia Pacific

John Bonnett

19 Cooroora Crescent
Lonsdale SA 5160
Australia

Phone: +61 (0) 8 8392 8366
Fax: +61 (0) 8 8392 8400
Email: [email protected]
Web: www.vision.zeiss.com

This email, including any attachments, is intended for the sole use of
the intended recipient(s) and may contain 
information that is confidential, privileged and/or the sender's work.
Any review or distribution by any other person is 
prohibited. If you are not an intended recipient, please immediately
contact the sender and delete all copies.


-----Original Message-----
From: Daniel Kasak [mailto:[email protected]] 
Sent: Friday, 23 March 2007 8:17 AM
To: Jonathan Trahair; [email protected]
Subject: Re: Error message "Row cannot be located for updating"

Jonathan Trahair wrote:

> Hi Everyone
>
> I am using VB6 and MySQL, recently installed. I have a FlexGrid of
items. I save them, and in a large order (25 or more) there will be at
least one which causes an error "Row cannot be located for updating.
Some values may have been changed since it was last read." The values
looked up have not changed, the only change might be price or quantity.
I tried looking the order items up on their unique record number
(primary key), then I tried on their order number, item name and colour
(a unique set of values). It's always the same item(s) in a given order,
but for different orders it will not be the same item, colour or row
number as other orders.
>
> I've been onto Google and found some stuff about Option=2 but that
didn't make any difference.
>
> Can anyone shed light on this dark area?
>   

Basically don't use recordsets for updating. Maybe the v5 driver will do
this properly, but I've never really had much success with the v3.51.x
driver. Use a read-only recordset for fetching from the database, and
any changes to the recordset you should send back as 'update table' 
commands. Sad but true. It's not hard to write some functions which
automate this.

Also as Venu pointed out, it's hard to give more specific answers, and
possibly point out things you're doing wrong, if you don't actually give
us any details of what you're doing.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [email protected]
website: http://www.nusconsulting.com.au


-- 
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.