xxbit
发贴: 8
积分: 0
|
于 2005-12-02 12:46
String procedure_name="update_user_data"; String call_procedure_string="{call "+procedure_name+"(?,?,?,?,?,?,?) }";
try{ Connection con; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=testDatabase","sa",""); CallableStatement callable_statement=con.prepareCall(call_procedure_string);//创建对象 callable_statement.setString(1,"xxbit"); callable_statement.setString(2,"xxb"); callable_statement.setInt(3,23); callable_statement.setString(4,"男"); callable_statement.setString(5,"哈尔滨"); callable_statement.setString(6,"11111"); callable_statement.setLong(7,2); callable_statement.executeUpdate(); con.close(); } catch(SQLException e1){ out.println("SQL异常!"); } %>
|