Inserting into database through swing
Hi,
I am trying to insert data into database throgh swing. I am able to connect to database but while executing the query I am getting sql exception.
My code is as follow.
String sql="INSERT INTO student(StudentID,Name,Address,FName,Sex,DOB,Branc h) "
+ "VALUES ('"+tfsid+"','"+tffname.getText()+"','"+taadd.getT ext()+"','"+tflname.getText()+"','"+tfgender.getTe xt()+"',"
+ "'"+tfdob+"','"+tfbranch.getText()+"')";
System.out.println("sql insert statement");
stmt.executeUpdate(sql);
I cant see any syntax error in the above statement.
Any help appreciated
Thanks!!!!
Re: Inserting into database through swing
Please see the announcements page for the use of code tags.
Any time you have an error please post the error message with your question. Error messages have this bad habit of telling what is wrong, and with that we can more easily help you