Bug #18690 Possible on-going problem
Submitted: 31 Mar 2006 14:19 Modified: 11 Sep 2007 18:21
Reporter: John Sharp Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (WinXP)
Assigned to: CPU Architecture:Any

[31 Mar 2006 14:19] John Sharp
Description:
I've just added the following comment to Bug #13776, is what I've said a real problem or do I need to buy a hat so that I may eat it?

-----

I've had this happen to me for the last few days and I've tracked the problem to
specifically to the inclussion of an auto increment field.

(See the how to repeat section now)

It would seem that the ODBC driver is creating the insert statement based on the select information, usually correct however it's a problem if one of those fields is an auto-inc. I don't know if it happens all of the time in all instances yet, haven't gotten around to doing it in other tables but it definately works with a TEXT field.

How to repeat:
Create a table like:

Table1 (
Field1 Integer Auto-inc
Field2 Text)

Do this code twice, one of them should error:
strSQL = "select * from Table1 Where 1=0"
oRec.Open strSQL, oConn, 1, 2 (lock the table properly but I use 1 and 2, they
have real variable names though)
oRec.AddNew
oRec("Field2") = ClientVariable
oRec.Update
oRec.Close

Suggested fix:
Change the behaviour of the ODBC driver so that only parameters that are provided are passed to the DB.
[11 Sep 2007 18:21] Jim Winstead
I can't repeat this with the latest 3.51.20. It's probably a bug that has already been fixed.