preparestmt.java
来自「j2EE」· Java 代码 · 共 31 行
JAVA
31 行
import java.sql.*;
class PrepareStmt
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
try
{ Connection con=DriverManager.getConnection("jdbc:odbc:test");
PreparedStatement pstmt=con.prepareStatement("update emp Set Salary=? Where Name=?");
pstmt.setInt(1,8000);
pstmt.setString(2,"Ashok");
pstmt.executeUpdate();
System.out.println("Record Updated");
con.close();
}
catch(SQLException e)
{
System.out.println(e);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?