String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";
String username="sa";
String password="123456";
try{
Class.forName("com.microsoft.jdbc.sqlserver.SqlServerDriver");
}catch(ClassNotFoundException ce){ }
try{
Connection con =DriverManager.getConnection(url,username,password);
PreparedStatement pstmt=con.preparedStatement("UPDATE friends SET salary=?");
pstmt.setInt(1,1000);
pstmt.executeUpdate();
System.out.println("记录更新成功");
con.close();
}catch(SQLException sqle){}