开发者

Queryin SQL table with "TEXT" datatype column in java

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜