⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewquerybean.java

📁 一个applet servlet之间通过序列化对象通讯的例子
💻 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();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -