medlistcontab.java

来自「一个很好的医院管理软件」· Java 代码 · 共 52 行

JAVA
52
字号
/**
 * 
 */
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 + =
减小字号Ctrl + -
显示快捷键?