Please help me in finding the syntax error, i have tried my best to point out but can’t.
String sql= "insert into ctable ("
+"id,"
+"name,"
+"address,"
+"phone,"
+"email,"
+"sale_Limit )"
+ "values (" +txtid.getText()+ ",'" +txtname.getText()+ "','" +txtaddress.getText()
+"','" + txtphone.getText()+ "','"+ txtemail.getText()+ "','"+txtsaleLimit.getText()
+ "')";
The immediate problem may well be missing quotes.
The bigger problem is that you’re including data directly in your SQL. You should be using parameterized SQL instead (via a
PreparedStatement), to avoid SQL injection attacks, separate code (SQL) from data (values), and to avoid data loss due to string conversions.