JSP+SQL2000+Tomcat 分页问题
在运行过程中出现以下错误:java.sql.SQLException:[Microsoft][SQLServer2000DriverforJDBC]Unsupported...
在运行过程中出现以下错误:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.absolute
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.first
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
分页的bean入下SplitPage:
package com.shop;
import java.sql.*;
import java.util.*;
public class SplitPage
{
//定义结果集对象
private ResultSet rs=null;
private ResultSetMetaData rsmd=null;
//总记录数目
private int rowCount;
//所分的逻辑页数
private int pageCount;
//每页显示的记录数目
private int pageSize;
//初始化,获取数据表中的信息
public void initialize(ResultSet rs,int pageSize)
{
this.pageSize=pageSize;
try
{
this.rs=rs;
this.rsmd=this.rs.getMetaData();
if (this.rs!=null)
{
this.rs.next();
this.rowCount = this.rs.getRow();
this.rs.first();
this.pageCount = (this.rowCount - 1) / this.pageSize + 1;
}
else
{
this.rowCount=0;
}
}
catch(SQLException e)
{
System.out.println(e.toString());
}
}
//将显示结果存到Vector集合类中
public Vector getPage(int ipage)
{
Vector vData=new Vector();
int n=ipage;
int m=0;
m=(n-1)*this.pageSize+1;
try
{
if (this.rs!=null)
{
if (n!=1)
{
this.rs.absolute(m);
}
for(int i=0;i<this.pageSize;i++)
{
String[] sData=new String[10];
for(int j=0;j<this.rsmd.getColumnCount();j++)
{
sData[j]=this.rs.getString(j+1);
}
if (sData==null)
{
break;
}
vData.addElement(sData);
this.rs.next();
}
}
}
catch(SQLException e)
{
System.out.println(e.toString());
}
return vData;
}
//获得页面总数
public int getPageCount()
{
return this.pageCount;
}
//获取数据表中记录总数
public int getRowCount()
{
return this.rowCount;
}
} 展开
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.absolute
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.first
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
分页的bean入下SplitPage:
package com.shop;
import java.sql.*;
import java.util.*;
public class SplitPage
{
//定义结果集对象
private ResultSet rs=null;
private ResultSetMetaData rsmd=null;
//总记录数目
private int rowCount;
//所分的逻辑页数
private int pageCount;
//每页显示的记录数目
private int pageSize;
//初始化,获取数据表中的信息
public void initialize(ResultSet rs,int pageSize)
{
this.pageSize=pageSize;
try
{
this.rs=rs;
this.rsmd=this.rs.getMetaData();
if (this.rs!=null)
{
this.rs.next();
this.rowCount = this.rs.getRow();
this.rs.first();
this.pageCount = (this.rowCount - 1) / this.pageSize + 1;
}
else
{
this.rowCount=0;
}
}
catch(SQLException e)
{
System.out.println(e.toString());
}
}
//将显示结果存到Vector集合类中
public Vector getPage(int ipage)
{
Vector vData=new Vector();
int n=ipage;
int m=0;
m=(n-1)*this.pageSize+1;
try
{
if (this.rs!=null)
{
if (n!=1)
{
this.rs.absolute(m);
}
for(int i=0;i<this.pageSize;i++)
{
String[] sData=new String[10];
for(int j=0;j<this.rsmd.getColumnCount();j++)
{
sData[j]=this.rs.getString(j+1);
}
if (sData==null)
{
break;
}
vData.addElement(sData);
this.rs.next();
}
}
}
catch(SQLException e)
{
System.out.println(e.toString());
}
return vData;
}
//获得页面总数
public int getPageCount()
{
return this.pageCount;
}
//获取数据表中记录总数
public int getRowCount()
{
return this.rowCount;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询