bonjour,
je viens de supprimer un client de ma table via la classe suivante mais il me sort une erreur que je comprend d'ou elle viens.de l'aide svp:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package aymen;
 
import java.sql.SQLException;
import javax.sql.*;
import java.sql.*;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
 
public class removeClient {
 MysqlDataSource bd=new MysqlDataSource();
 Connection con;
 Statement stat;
 ResultSet res;
 int i;
	public removeClient(int i) {
		this.i=i;
		bd.setUrl("jdbc:mysql://localhost:3306/facturation");
		bd.setDatabaseName("facturation");
		bd.setUser("root");
		bd.setPassword("");
		try {
			con=  bd.getConnection();
			stat=con.createStatement();
			res=stat.executeQuery("DELETE  FROM `client` WHERE `id_client`="+i);
 
 
 
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
public static void main(String args[])
{
removeClient rr=new removeClient(3);	
}
}
et voila l'erreur:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:413)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1336)
at aymen.removeClient.<init>(removeClient.java:23)
at aymen.removeClient.main(removeClient.java:34)
merci