Hi
When I try and retrieve data from my database and send the result to the 'text' variable then output it the query works, however when I try and send the result to 'bcTF1.setText(rs.getString(i));' (textField) it says no data found. any ideas? thanx in advance
public void executeQuery() throws SQLException {
boolean foundResults =
statement.execute("SELECT Blink1, Blink2, Blink3, Blink4, Reason, Effect " +
"FROM BlinkCode WHERE BlinkCodeID = 1");
if(foundResults){
ResultSet set = statement.getResultSet();
if(set!=null) displayResults1(set);
}else {
connection.close();
}
}
void displayResults1(ResultSet rs) throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
int columns=metaData.getColumnCount();
String text="";
new Blinkcodes().setVisible(true);
while(rs.next()){
for(int i=1;i<=columns;++i) {
text+="<"+metaData.getColumnName(i)+">";
text+=rs.getString(i);
bcTF1.setText(rs.getString(i));
// text+="</"+metaData.getColumnName(i)+">";
text+="/n";
}
text+="/n";
}
System.out.println(text);
}
Message was edited by:
crashEvans