?? viewquerybean.java
字號:
package espc;import java.io.PrintStream;import java.sql.*;// Referenced classes of package gzcims.netsell:// DbConnectionpublic class ViewQueryBean{ DbConnection dc; ResultSet rset; public ViewQueryBean() { dc = null; rset = null; dc = new DbConnection(); } public boolean openConnection() { System.out.println("OPEN CONNECTION!!!"); return dc.openConnection(); } public void executeQuery(String query) throws SQLException { rset = dc.executeQuery(query); System.out.println("Execute Query!!!"); } public void executeUpdate(String query) throws SQLException { dc.executeUpdate(query); } public int getColumnCount(int index) throws SQLException { ResultSetMetaData rsmd = rset.getMetaData(); return rsmd.getColumnCount(); } public String getColumnName(int index) throws SQLException { ResultSetMetaData rsmd = rset.getMetaData(); return rsmd.getColumnName(index); } public String getData(int index) throws SQLException { String returnValue = rset.getString(index); if(rset.wasNull()) return "Null"; else return rset.getString(index).trim(); } public String getData(String columnName) throws SQLException { String returnValue = rset.getString(columnName); if(rset.wasNull()) return "Null"; else return rset.getString(columnName).trim(); } public String getString(int index) throws SQLException { String returnValue = rset.getString(index); if(rset.wasNull()) return "Null"; else return rset.getString(index).trim(); } public int getInt(int index) throws SQLException { String returnValue = rset.getString(index); if(rset.wasNull()) return 0; else return rset.getInt(index); } public String getString(String columnName) throws SQLException { String returnValue = rset.getString(columnName); if(rset.wasNull()) return "Null"; else return rset.getString(columnName).trim(); } public float getFloat(String columnName) throws SQLException { float returnValue = rset.getFloat(columnName); if(rset.wasNull()) return 0.0F; else return rset.getFloat(columnName); } public int getInt(String columnName) throws SQLException { float returnValue = rset.getFloat(columnName); if(rset.wasNull()) return 0; else return rset.getInt(columnName); } public boolean next() throws SQLException { return rset.next(); } public boolean first() throws SQLException { return rset.first(); } public boolean last() throws SQLException { return rset.last(); } public boolean absolute(int intRow) throws SQLException { return rset.absolute(intRow); } public int getNumber() throws SQLException { rset.last(); int returnNumber = -rset.getRow(); return returnNumber; } public void close() throws SQLException { System.out.println("CLOSE CONNECTION!!!"); if(rset != null) rset.close(); if(dc != null) dc.close(); } protected void finalize() throws Throwable { close(); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -