首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

java.sql.SQLException:[Microsoft][ODBC 驱动程序管理器] 无效的游标状态

2014-01-26 
------解决方法--------------------------------------------------------] 无效的游标状态%! Connection

------解决方法--------------------------------------------------------] 无效的游标状态

<%!
Connection con= null;
Statement stmt = null;
ResultSet rs;

%>
<%
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
con=DriverManager.getConnection( "jdbc:odbc:jsjdj ");
stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
String itemid=request.getParameter( "id ");
String sql = "select * from Notice where myid= "+itemid+ " ";
rs = stmt.executeQuery(sql);
String title = rs.getString(2) ;
String content = rs.getString(3) ;
%>
<%
while(rs.next())
{
%>
<form action= "update_do.jsp " method= "post " name= "mdfform "
onSubmit= "javaScript: return validateMdf(); ">
<tr>
  <td bgcolor= "#cccccc " width= "65 " height= "67 "> 题目: </td>
  <td bgcolor= "#cccccc " width= "298 "> <input type= "text " name= "title " height= " "value= " <%=title%> "> </td>
</tr>
<tr>
  <td bgcolor= "#cccccc " width= "65 " height= "107 "> 内容: </td>
  <td bgcolor= "#cccccc " width= "298 "> <textarea name= "content " cols= "30 " rows= "6 "> <%=content%> </textarea> </td>
</tr>



<tr align= "center " bgcolor= "#996633 ">
  <td height= "25 " colspan= "2 "> <input name= "Submit " type= "submit " value= " 提交 ">
&nbsp;&nbsp;
  <input name= "Submit1 " type= "reset " value= " 重 设 ">
  <input name= "id " value= " <%=itemid%> "> </td>
</tr>
</form>
<% }
rs.close();
stmt.close();
con.close();
%>
小妹初学jsp,请高手指教下这是什么原因?

------java.sql.SQLException:[Microsoft][ODBC 驱动程序管理器] 无效的游标状态 解决方法--------------------------------------------------------
String sql = "select * from Notice where myid= "+itemid+ " ";