technoid
12-03-07, 08:00 AM
I'm trying to learn MySQL using ASP and I'm getting a syntax error when I try to add a row to an empty table I created, does anyone know what's wrong with the last line of the code I'm using? Or anything else for that matter. It seems to connect to MySQL but I get the error message below. The name of the table in MySQL is 'order' so that part should be okay, I think, at least I looked and it shows the name 'order'. The 'id' element is auto incrementing and I've tried leaving it out of the update list too. Thanks for any help.
CODE
connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
Set oRS = oConn.Execute ( "INSERT INTO order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')" )
ERROR
[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-max-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')' at line 1
CODE
connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
Set oRS = oConn.Execute ( "INSERT INTO order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')" )
ERROR
[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-max-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')' at line 1