?? jdbcinsert.java
字號:
//Program to Insert a Record into the ChinaCities Table
import java.sql.*;
public class JDBCInsert{
public static void main(String[]args){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException ce){
System.out.println(ce.getMessage());
ce.printStackTrace();
}
try{
Connection con=DriverManager.getConnection("jdbc:odbc:個人資料");
String sqlquery="INSERT INTO 個人資料 VALUES ('yuan','200232580170','J2EE')";
Statement stmt=con.createStatement();
int flag=stmt.executeUpdate(sqlquery);
System.out.println(flag+"rows inserted");
stmt.close();
con.close();
}
catch(SQLException se){
System.out.println("SqlException"+se.getMessage());
se.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -