📄 preparestmt.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -