Last post Apr 22, 2010 06:48 AM by steinj14
Apr 21, 2010 01:57 PM|steinj14|LINK
Hi, I'm developing an ASP.NET app with a MySQL backend, using the MySQL Connector Net 6.2.3. I have a DetailsView with an insert command that is throwing the error:
MySql.Data.MySqlClient.MySqlException: 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 '?,?,?,?,?,?,?,?)'
at line 1
My code is:
If I hardcode values into the insert statement, it works fine. But when I put the ? placeholder in, it throws the error. Can anyone help me pinpoint the problem or offer a workaround solution?
Apr 21, 2010 04:06 PM|Mikesdotnetting|LINK
I believe the syntax for your provider is to follow the parameter name after the ?
Eg: INSERT INTO coupons (userid, title, line1, line2, terms, startdate, expdate, code) VALUES (?userid,?title,?line1,?line2,?terms,?startdate,?expdate,?code)
Apr 22, 2010 06:48 AM|steinj14|LINK
Thanks, that worked perfectly. Still trying to learn the differences between SQL Server and MySQL syntax...