tags:

views:

37

answers:

1

i have a "TEXT" type column in a sql database. I queried it with

ResultSet rs=db.execSQL(query);
String s=rs.getString("text_field");

creates and error. how should i use this text column in my java?

+1  A: 

This looks like Java and JDBC (the standard API to uses databases with Java.

Here is a tutorial, chapter 3.2.2 shows the general solution to your problem. You have to call next() on the result set to set the pointer to the next row.

Applied to your code, this should give some progress:

ResultSet rs=db.execSQL(query);
while(rs.next()) {
   String s=rs.getString("text_field");
   // do something with s
}
Andreas_D
hey thanks man!!
Felix