📄 medlistcontab.java
字号:
/**
*
*/
package src;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MedListConTab {
private ResultSet rs=null;
public MedListConTab() {
super();
Connection conn=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(Exception e){
System.out.println("Not Found Driver!!!");
}
try{
conn=DriverManager.getConnection("jdbc:odbc:Hospital","","");
Statement stmt=conn.createStatement();
// stmt.setMaxRows(1);
rs=stmt.executeQuery(
"select docNo,docName from doctor");
int i=rs.getRow();
while(rs.next())
{
String docNo=rs.getString("docNo");
String docName=rs.getString("docName");
int x=rs.getRow();
System.out.println(docNo+docName + x + i);
}
conn.close();
}catch(SQLException e){
System.out.println("Link Error");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new MedListConTab();
System.out.println("Test");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -