I don't think it is necessary to share this question. I have to solve the problem about Column CAN NOT BE RE-Read, although this article is issued by an online article affects the JSP page:
View_edit.jsp1
Part of the ListsBean:
21 public Lists getListsInfo (String listsId) throws Exception22 {23 24 Statement stmts = con.createStatement (); 25 ResultSet rsts = stmts.executeQuery ( "select * from list_table where id = '" listsId "'"); 26 Lists lists = NULL; 27 While (RSTS.Next ()) 28 {29 30 3132 lists = new lists (); 3334 Lists.SetItemName (RSTS.GetString ("item_name"); 35 lists.setListTypeId (RSTS.GETSTRING ("list_type_id "));
} Return lists;
[Microsoft] [SQLSERVER 2000 Driver for JDBC] ResultSet Can not Re-Read Row Data for Column 2
I started me to think that it was 1, 2, the BEAN and the 5th line of the BEAN conflict, and there was no problem. . . Depressed. . So search for BAIDU is inspired by one article.
Problem Cause: 34 lines of item_name and 35 lines list_type_id in the database are list_type_id, Item_name is not right in JDBC access order in JavaBean.
The solution will change the 34 and 35 to change the position! ! ! I hope that you will find this article as soon as possible and help you --- inberkong
Quote original: Use JDBC to connect MS SQL Ser2000 SP2 you want to print, is: Use JDBC to connect MS SQL Ser2000 SP2 Print this article
Use JDBC to connect MS SQL SER2000 SP2
Author: Anonymous Copy from: Site author Hits: 8
When I learned J2EE, I used JDBC to connect to MS SQL Server 2000. Everything was normal, but later I met a very headache, that is, we read the data from the table to the ResultSet, read columns The value is read in the order of the column.
For example, if there are three coli IDs, name, address, the results obtained by the condition query are placed in the resultSet, if the result is displayed, if this is written: java.sql.resultset Employees; while (Employees.next ()) {Employees.getstring (address); Employees.getstring (name);
When running, the column can not be re-read error, then reverse the two statements (this article only applies to the MS SQL Server 2000) Connecting the database code as follows:
try {Class.forName (com.microsoft.jdbc.sqlserver.SQLServerDriver); conn = DriverManager.getConnection (jdbc: microsoft: sqlserver: // localhost: 1433; DatabaseName = Hotel; User = sa; Password = sa); // Class.forName (sun.jdbc.odbc.JdbcOdbcDriver); // conn = DriverManager.getConnection (jdbc: odbc: hotel);} catch (SQLException e) {System.err.println (e);} catch (ClassNotFoundException e) {System.err.println (e);