?? example15_4.java
字號:
import java.sql.*;
public class example15_4
{
public static void main(String args[])
{
Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.println(""+e);
}
try
{
con=DriverManager.getConnection("jdbc:odbc:mmm","mcx","123");
sql=con.createStatement();
String condition="SELECT * FROM stu ORDER BY score";
rs=sql.executeQuery(condition);
while(rs.next())
{
int number=rs.getInt(1);
String name=rs.getString(2);
String course=rs.getString("course");
int score=rs.getInt("score");
System.out.println("學號"+number);
System.out.println("姓名"+name);
System.out.println("成績"+score);
System.out.println("課程"+course);
}
con.close();
}
catch(SQLException e)
{System.out.println(e);}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -