i have a "TEXT" type column in a sql database. I queried it with开发者_Go百科
ResultSet rs=db.execSQL(query);
String s=rs.getString("text_field");
creates and error. how should i use this text column in my java?
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
}
精彩评论