I am attempting to execute an INSERT statement on my page but continually get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '<'.
/int_code04/myNMLC/insertNewTrackR ecord.asp, line 97
I've tested the INSERT stmt both within SQL Server and as a string literal within the page's code with hardcoded values to ensure that the statement works, which is does. But when I assign this statement to a variable using the variables containing the values and then execute it (as shown below), it doesn't work:
"mySQL="INS ERT INTO nsn_shipment_tr acking_lines (fk_nsn_shipmen t_tracker, qty_shipped, date_shipped, date_received, tracking_number , shipping_compan y, date_entered) VALUES (" & fk_ID & ", " & qty_shipped & ", " & shipped_dt_and_ clause & ", " & received_dt_and _clause & ", '" & tracking_number & "'," & shipping_compan y & ", getdate())"
cn.Execute(mySQ L)"
When I Response.write the contents of my variable containing the above SQL statement (response.write (mySQL)), I get the following:
INSERT INTO nsn_shipment_tr acking_lines (fk_nsn_shipmen t_tracker, qty_shipped, date_shipped, date_received, tracking_number , shipping_compan y, date_entered) VALUES (890
, 450, '10/30/2009', '11/8/2009', 'DFTG4385DRE673 ', 1, getdate())
This looks right to me but again, this doesn’t work. One other “process of elimination” thing I tried was to first remove all of the date field values from the INSERT statement, to see if I could accomplish an insert with out these values (since most fields in the table allow for NULL values). The result was this didn’t make a difference. Then I tried the insert one field at a time; this also made no difference.
Any insight to this troubling issue would be greatly appreciated! Thanks in advance!
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '<'.
/int_code04/myNMLC/insertNewTrackR ecord.asp, line 97
I've tested the INSERT stmt both within SQL Server and as a string literal within the page's code with hardcoded values to ensure that the statement works, which is does. But when I assign this statement to a variable using the variables containing the values and then execute it (as shown below), it doesn't work:
"mySQL="INS ERT INTO nsn_shipment_tr acking_lines (fk_nsn_shipmen t_tracker, qty_shipped, date_shipped, date_received, tracking_number , shipping_compan y, date_entered) VALUES (" & fk_ID & ", " & qty_shipped & ", " & shipped_dt_and_ clause & ", " & received_dt_and _clause & ", '" & tracking_number & "'," & shipping_compan y & ", getdate())"
cn.Execute(mySQ L)"
When I Response.write the contents of my variable containing the above SQL statement (response.write (mySQL)), I get the following:
INSERT INTO nsn_shipment_tr acking_lines (fk_nsn_shipmen t_tracker, qty_shipped, date_shipped, date_received, tracking_number , shipping_compan y, date_entered) VALUES (890
, 450, '10/30/2009', '11/8/2009', 'DFTG4385DRE673 ', 1, getdate())
This looks right to me but again, this doesn’t work. One other “process of elimination” thing I tried was to first remove all of the date field values from the INSERT statement, to see if I could accomplish an insert with out these values (since most fields in the table allow for NULL values). The result was this didn’t make a difference. Then I tried the insert one field at a time; this also made no difference.
Any insight to this troubling issue would be greatly appreciated! Thanks in advance!
Comment