Hi
I have created a database from reading a text file, but I'm having problems displaying data in a text area. I am using Netbeans IDE 6.0.
This is the error:
SEVERE: null
java.sql.SQLException: Column Index out of range, 2 > 1.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.checkColumnBounds(ResultSet.java:690)
at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:5625)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:5544)
The following code works:
CODE
try {
rs = db.query("SELECT * FROM tblCommunity");
txaDisplay.setText(processTblChest(rs));
} catch (SQLException ex) {
Logger.getLogger(mainGUI.class.getName()).log(Level.SEVERE, null, ex);
}
The following code does not work:
CODE
try {
rs = db.query("SELECT selection FROM tblCommunity WHERE chestID = 3");
txaDisplay.setText(processTblChest(rs));
} catch (SQLException ex) {
Logger.getLogger(mainGUI.class.getName()).log(Level.SEVERE, null, ex);
}
Sample of text file:
1#Move forward by 2 spaces#2#3#
2#Move forward by 5 spaces#5#3#
3#Move back 3 spaces#-3#3#
4#Move back 5 spaces#-5#3#
The following code is a sample of the variable type:
CODE
db.update("CREATE TABLE namesdata.tblCommunity(chestID INTEGER, Descrip CHAR(100), Amount INTEGER, Selection INTEGER, PRIMARY KEY(chestID));");
Thanks