提示出错::[Microsoft][ODBC 驱动程序管理器] 无效的游标状态 !非常急~
事先也在网上搜过这个问题,
但一直没有弄好,
因为是初学的,
希望回复的可以说的明白点~
谢谢!
贴上一部分代码,请大家帮帮忙~周一前要交的~
try {
String url = "jdbc:odbc:equipment ";
conn = DriverManager.getConnection(url);
stmt = conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = null;
String sql = "select count(*)as recordcount
from dbo.equipmentCL where CLname= ";
sql += " ' " + name + " ' ";
rs = stmt.executeQuery(sql);
if (rs.next())
intRowCount = rs.getInt( "recordcount ");
sql = "select CLnumber,CLname,CLxinghao,CLfactory,CLquantity
from dbo.equipmentCL where CLname= ";
sql += " ' " + name + " ' ";
rs = stmt.executeQuery(sql);
if (intRowCount % intPageSize == 0)
intPageCount = intRowCount / intPageSize;
else {
intPageCount = (intRowCount / intPageSize) + 1;
}
if (intPageCount == 0)
intPageCount = 1;
if (request.getParameter( "Page ") == null
|| request.getParameter( "Page ").equals( " "))
intPage = 1;
else
try {
intPage = Integer.parseInt
(request.getParameter( "Page "));
} catch (
java.lang.NumberFormatException e) {
intPage = 1;
}
万分感谢~
------解决方案--------------------楼主你的代码也太难读了
没有缩排,if,else也没有用{}分开
有时良好的代码格式有利于提高效率
我开你一个sql就写错了
select count(*)as recordcount
from dbo.equipmentCL where CLname= ";
------------------
select count(*) as recordcount
要用空格隔开
------解决方案--------------------帮顶,学习中~~
------解决方案--------------------看看
------解决方案--------------------String url = "jdbc:odbc:equipment ";
是不是这个没有找到啊
你用System.out.println();这个看看执行到那里就不行了