471,083 Members | 1,178 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,083 software developers and data experts.

preparedStatement issue

The following update fails, but whenever I use a prepared statement
with two or less parameters, the update succeeds. I'm at a loss, but
think it might have something to do with the driver (J/Connector
3.0.1.1). Any ideas?.

String lastname = emp.getLastName();
String firstname = emp.getFirstName();
String empid = emp.getEmpID();
int deptno = emp.getDeptNo();
String deptname = emp.getDepartment()

String sql1 = "UPDATE employee SET LastName=?, FirstName=?, DeptNo=?,
DeptName=? WHERE EmpID=?
Connection dbcon = dbc.getConnection();
try{

prepstmt1 = dbcon.prepareStatement(sql1);
prepstmt1.setString(1, lastname);
prepstmt1.setString(2, firstname);
prepstmt1.setInt(3, deptno);
prepstmt1.setString(4, deptname);
prepstmt1.setString(5, empid);
}
catch(SQLException ez){
}
result1= dbc.executeUpdate(prepstmt1);

Thanks
Jul 20 '05 #1
0 1029

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Dov Moryusef | last post: by
3 posts views Thread by info | last post: by
13 posts views Thread by SAL | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.