Hi all,
i have a strange situation here,
i am trying to execute an sql insert via prepared statements.
though it is a simple insert process, i am having a syntax error message.
Doesn't mysql support this?
can someone please tell me what is wrong with this query?
String query="insert into temp(member ,ename,cname,jname ,sex ,age ,"+
"nation ,prf ,occ ,educ ,address ,city ,res_city,res_address ,"+
"htel ,mtel,otel ,fax ,email) "+
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement stmt=conn.prepareStatement(query);
stmt.setString(1,member);
stmt.setString(2,ename);
stmt.setString(3,cname);
stmt.setString(4,jname);
stmt.setString(5,sex);
stmt.setInt(6,age);
stmt.setString(7,nation);
stmt.setString(8,prf);
stmt.setString(9,occ);
stmt.setString(10,educ);
stmt.setString(11,address);
stmt.setString(12,city);
stmt.setString(13,res_city);
stmt.setString(14,res_address);
stmt.setString(15,htel);
stmt.setString(16,mtel);
stmt.setString(17,otel);
stmt.setString(18,fax);
stmt.setString(19,email);
stmt.executeUpdate(query);
stmt.close();
conn.close();
the error message says:
javax.servlet.ServletException: Syntax error or access violation: You have
an error in your SQL syntax near '?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' at
line 1
thanks a lot in advance :)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php