Question : MySQL Auto Increment in Version 5.1

Hello,

I just migrated from MySQL 4.1 to 5.1.  I'm getting errors on INSERT statements that have Auto Increment fields.  The error is:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 5.1 Driver][mysqld-5.1.48-community]Incorrect integer value: '' for column 'EMID' at row 1

The abend occurs at the Execute method of the ADO command object in ASP Classic.

Sample code is below.  In version 4.1, you could insert a pair of single quotes for the  Auto Increment field.  This does not appear to work in Version 5.1.  In the code snippet, the first field is the Auto Increment field, and it is defined as an unsigned integer on the MySQL table.

Advice please.

Thank you, Stu Engelman
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
set CN=server.CreateObject("ADODB.Connection")
CN.Open "dsn=" & application("dbodbcdsn"),application("dbusername"),application("dbpassword")
set CM=server.CreateObject("ADODB.Command")
CM.ActiveConnection=CN
CM.CommandType=adCmdText
SQL="insert into emails values("
SQL=SQL & "'',"
SQL=SQL & "'" & Request.Form("first_name") & "',"
SQL=SQL & "'" & replace(Request.Form("last_name"),"'","´") & "',"
SQL=SQL & "'" & Request.Form("email_address") & "',"
SQL=SQL & "'" & "(" & Request.Form("areacode") & ") " & Request.Form("prefix") & "-" & Request.Form("phone") & "',"
SQL=SQL & "'" & Request.Form("request") & "',"
SQL=SQL & "'" & replace(Request.Form("comments"),"'","´") & "',"
SQL=SQL & "'" & SQLPrepare(now) & "');"
CM.CommandText=SQL
CM.Execute

Answer : MySQL Auto Increment in Version 5.1

Have you associated the subnet (within AD Sites and Services) with the desired site?
Random Solutions  
 
programming4us programming4us