12 messages in com.mysql.lists.win32RE: ADO and MySQL Error| From | Sent On | Attachments |
|---|---|---|
| Christian Surya | 16 Dec 2004 01:08 | |
| Daniel da Veiga | 16 Dec 2004 05:39 | |
| Peter Harvey | 16 Dec 2004 08:03 | |
| Michael Avila | 16 Dec 2004 14:48 | |
| Christian Surya | 16 Dec 2004 18:18 | |
| Peter Harvey | 16 Dec 2004 22:12 | |
| Christian Surya | 16 Dec 2004 23:34 | |
| Ruben Edna | 16 Dec 2004 23:56 | |
| Charles Metcalfe | 17 Dec 2004 00:34 | |
| HMax | 17 Dec 2004 01:07 | |
| Christian Surya | 17 Dec 2004 01:26 | |
| Bernard LEFEUVRE | 24 Dec 2004 02:32 |
| Subject: | RE: ADO and MySQL Error![]() |
|---|---|
| From: | Ruben Edna (rube...@edcom.no) |
| Date: | 12/16/2004 11:56:44 PM |
| List: | com.mysql.lists.win32 |
This happens all the time using ADO and recordset updates. It might work perfectly with thousends of records, and then suddenly out of nowhere exactly what you explain will happen.
We have a "huge" database system based on MySQL database (last two versions) using MyODBC (last three versions). Our largest customer have over 2 million table updates every day...
Using recordset updates we fast discovered that there is no logic when your problem will occur. Only solution that always works is to never use recordset updates. Instead you should use connection SQL execute like this: oCon.Execute "UDPATE arapk SET jnsfrm = '" & var1 & "', tglapk = '" & var2 & "' WHERE apknum = " & apknum & ";"
You will still have to use recordset to do the "if oRS.EOF then" check.
I also highly recommend you to not use recordset addnew too... use instead the following: oCon.Execute "INSERT INTO arapk (jnsfrm, tglaps, ...) VALUES ('" & var1 & "',' & var2 & ",...);"
If you need to know what autoincrement value your insert got use this immediately after:
Dim lngAutoID As Long lngAutoID = GetLastInsertID(oCon)
Public Function GetLastInsertID(dbConn As ADODB.Connection) As Long Dim rsLastInsertID As New ADODB.Recordset rsLastInsertID.Open "SELECT LAST_INSERT_ID()", dbConn, adOpenKeyset, adLockOptimistic GetLastInsertID = rsLastInsertID![LAST_INSERT_ID()] rsLastInsertID.Close End Function
Best regards, Ruben Edna
-----Original Message----- From: Christian Surya [mailto:csur...@gmail.com] Sent: 17. desember 2004 08:35 To: Peter Harvey Cc: win...@lists.mysql.com; myo...@lists.mysql.com Subject: Re: ADO and MySQL Error
Thanks a lot peter hope it can fix soon
Best Regards, Christian
On Thu, 16 Dec 2004 22:12:26 -0800, Peter Harvey <phar...@mysql.com> wrote:
I have bumped up the Severity and the Priority of Bug 5427.
Peter Harvey, Software Developer MySQL AB, www.mysql.com Are you MySQL certified? www.mysql.com/certification
-----Original Message----- From: Christian Surya [mailto:csur...@gmail.com] Sent: December 16, 2004 6:19 PM To: Peter Harvey Cc: win...@lists.mysql.com; myo...@lists.mysql.com Subject: Re: ADO and MySQL Error
Hi Peter,
This is the code I use for the recordset strSQL="SELECT * FROM arapk WHERE apknum = "+apknum oRS.Open strSQL, oCon,1,3 if oRS.EOF then ors.addnew end if <change data here> ors.update 'generate same error with ors.updatebatch ors.close set ors = nothing
the structure is nomapk double, auto inc jnsfrm char(1) tglapk datetime kodelk double nomdel double jenpiu char(1) nampem varchar(30) alpem1 varchar(30) alpem2 varchar(30)
there is another field but i can't write it here because too long. for information the datatype of all field is one of the following datatype : double,char,varchar and datetime and all field is not null
i'm sorry i can't give you sample data because my company is strict
thanks for your help peter
ps: i have reply from daniel and michael. they say my problem is because the bug from myodbc and have been listed on the http://bugs.mysql.com/bug.php?id=5427 but why there is no fixed for that problem?
On Thu, 16 Dec 2004 08:03:28 -0800, Peter Harvey <phar...@mysql.com> wrote:
Please provide;
- VB code to demonstrate the problem - table structure of the table in question - small amount (4 or 5 rows) of sample data if possible
Peter Harvey, Software Developer MySQL AB, www.mysql.com Are you MySQL certified? www.mysql.com/certification
-----Original Message----- From: Christian Surya [mailto:csur...@gmail.com] Sent: December 16, 2004 1:09 AM To: win...@lists.mysql.com; myo...@lists.mysql.com Subject: ADO and MySQL Error
Hi, I have a problem with VB6 SP6, ADO2.8 and MySQL database version 4.1.7 and ODBC 3.51.10. i use Update function of the recordset and it raise error when update the database. the error is "Query-based update failed because the row to update could not be found." These error only occur if i want update data not insert.and the error source is from ODBC engine. anyone can help me?
thanks in advance chris
-- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=pet...@mysql.com
-- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=pet...@mysql.com
-- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/myodbc?unsub=rube...@edcom.no




