1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
try {
//String jdbcDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String jdbcURL = "jdbc:sqlserver://192.168.10.202:1433;databaseName=MaDatabase";
String user = "Moi";
String password= "MonMotDePasse";
Connection connection = DriverManager.getConnection(jdbcURL, user, password);
String nCMD = "CC59573";
String queryString="Update dbo.SaleDocument set DocumentState=6 where DocumentNumber='"+nCMD+"'";
Statement sqlStatement = connection.createStatement();
sqlStatement.executeUpdate(queryString);
connection.close();
} catch (ClassNotFoundException | SQLException ex) {
ex.printStackTrace();
} |