?? 0216.htm
字號:
<html>
<head>
<title>新時代軟件教程:操作系統 主頁制作 服務器 設計軟件 網絡技術 編程語言 文字編輯</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
body, table {font-size: 9pt; font-family: 宋體}
a {text-decoration:none}
a:hover {color: red;text-decoration:underline}
.1 {background-color: rgb(245,245,245)}
-->
</style>
</head>
<p align="center"><script src="../../1.js"></script></a>
<p align="center"><big><strong>使用JDBC創建數據表格</strong></big></p>
<div align="right">---摘自互聯網</div>
<br>import java.sql.*;<br>
<br>
public class CreateAccount<br>
{<br>
<br>
public static void main(String args[])<br>
{<br>
String userName="";<br>
String password="";<br>
String url = "jdbc:odbc:account";<br>
<br>
String createString = "CREATE TABLE account " +<br>
"(account_no integer, " +<br>
"account_name varchar(35), " +<br>
"start_date date, " +<br>
"balace numeric, " +<br>
"address varchar(150))";<br>
try<br>
{<br>
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");<br>
}<br>
catch (ClassNotFoundException e)<br>
{<br>
System.err.println("ClassNotFoundException: " + e);<br>
}<br>
<br>
try<br>
{<br>
Connection con = DriverManager.getConnection(url, userName, password);<br>
Statement stmt = con.createStatement();<br>
stmt.executeUpdate(createString);<br>
<br>
stmt.close();<br>
con.close();<br>
System.out.println("Account database created");<br>
}<br>
catch(SQLException e)<br>
{<br>
System.err.println("SQLException: " + e);<br>
}<br>
}<br>
} <br>
</table>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -