Pavi
Pavi

Reputation: 345

Update Prepared Statement in Sql Server 2008

I am trying to update the table from my Java class.

con.prepareStatement("update New_Test_Master_School set School_Name=? where School_Code=? ");
ps.setString(1, bean.getSname());
ps.setString(2, bean.getScode());
System.out.println("before executeUpdate");
int i=ps.executeUpdate();

But executeUpdate() is not executing. I used if condition to check it. Its not executing. I got the values for bean.

Upvotes: 0

Views: 2159

Answers (1)

Rohit Jain
Rohit Jain

Reputation: 213261

executeUpdate returns an integer value which is the number of rows successfully updated.. So, make your LHS an integer type: -

int result = ps.executeUpdate();

Upvotes: 2

Related Questions