MYSQL SQL syntax error c# -


i have error in sql statement. query:

 mysqlcommand cmd = new mysqlcommand("insert bills (bill_number,bill_date,bill_from,bill_note,bill_taxrate,bill_disrate,bill_entrydate,cus_sup,by,archived) values(" + txbbillnumber.text + ",'" + datetime.parse(txbbilldate.text).year + "-" + datetime.parse(txbbilldate.text).month + "-" + datetime.parse(txbbilldate.text).day + "'," + sup_id + ",'" + txb_note.text + "'," + taxrate + "," + disrate + ",'" + datetime.now.year + "-" + datetime.now.month + "-" + datetime.now.day + "'," + bills.cus_sup + ",0,0)", objconn);                         cmd.executenonquery(); 

and in image error , bills table structure: screebshot1

one problem word by use column reserved keyword (both in mysql , sql standard in general). use have enclose in backticks `` or double-quotes " ".

also, string values need between single-quotes applicable, think got that.

on side note should using parametrized queries instead of concatenating. see question example: c# mysql insert parameters


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -