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;
}

