im getting the error "Invalid call Statement method: {0}"

Hi !!

In my program im trying to make an update

here is my program

The thing is that the update is taking place, i mean its working but its showing this error !!

[Microsoft][SQLServer 2000 Driver for JDBC]Invalid call Statement method: {0}

Connection connection =null;

try{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());

}

catch (Exception E){

System.out.println("Unable to load driver.");

System.out.println(E.getMessage());

E.printStackTrace();

return;

}

try{

connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;user=sa;password=sa;DatabaseName=carnet");

}

catch (Exception E){

System.out.println("Unable to connect.");

System.out.println(E.getMessage());

return;

}

try

{

Statement stmt = connection.createStatement();

jLabel10.setText("");

if(jComboBox1.getSelectedItem()=="fiche")

{

String Pno="";

Pno=jTextField9.getText();

String Query ="UPDATE fiche SET No=?,Nom=?,Prenom=?,Adresse=?, Cpostale=?,Ville=?,Tel=? where No='"+Pno+"'";

PreparedStatement pstmt = connection.prepareStatement(Query);

pstmt.setString(1,jTextField9.getText());

pstmt.setString(2,jTextField1.getText());

pstmt.setString(3,jTextField2.getText());

pstmt.setString(4,jTextField3.getText());

pstmt.setString(5,jTextField4.getText());

pstmt.setString(6,jTextField5.getText());

pstmt.setString(7,jTextField6.getText());

pstmt.executeUpdate();

System.out.println(Query);

int Resultat = pstmt.executeUpdate(Query);

}

}

catch (Exception e)

{

System.out.println("Unable to query");

System.out.println(e.getMessage());

return;

}

[3010 byte] By [roseddeeepssa] at [2007-10-2 14:22:12]
# 1

> pstmt.executeUpdate();

There's the update.

> int Resultat = pstmt.executeUpdate(Query);

What's this for? That's wrong. You already executed the update correctly above.

Also, what's the deal with using a PreparedStatement for MOST of the paremeters, but not this one?

> where No='"+Pno+"'";

You should use a parameter there too...

... "where No=?"

pstmt.SetString(8, Pno);

warnerjaa at 2007-7-13 12:40:40 > top of Java-index,Java Essentials,New To Java...
# 2
And "UPDATE FICHE SET NO=27 WHERE NO=27" is redundant. You don't have to set the "No" column to the value it already has. (That isn't the cause of your posted problem, though.)
DrClapa at 2007-7-13 12:40:40 > top of Java-index,Java Essentials,New To Java...
# 3
Hi!!!Yes i know tat , i put the set No in addition, but its now only that its working !!if i tk it off, it update the complete Database with the same data!!
roseddeeepssa at 2007-7-13 12:40:40 > top of Java-index,Java Essentials,New To Java...