【发布时间】:2013-01-23 11:24:08
【问题描述】:
我有一个例外,即这一行中的数据类型不匹配
byte[] _data = (byte[])row.getBlobBytes(1);
在表格中,我的第 2 列的类型是 BLOB。
public static UrlRsc getContentUrl(String name) {
UrlRsc elementRsc = null;
try {
Statement statement = DB
.createStatement("SELECT * FROM table where"
+ " Name='"
+ name + "'");
statement.prepare();
Cursor cursor = statement.getCursor();
Row row;
while (cursor.next()) {
row = cursor.getRow();
byte[]_data;
_data = row.getBlobBytes(1);
}
statement.close();
cursor.close();
} catch (DatabaseException dbe) {
System.out.println(dbe.toString());
} catch (DataTypeException dte) {
System.out.println(dte.toString());
}
return elementRsc;
}
谁能帮帮我?
【问题讨论】:
-
你能分享你的sql吗?
-
检查我编辑我的问题
-
你能告诉
cursor.getColumnName(1)的结果是什么吗?使用row.getBlobBytes(row.getColumnIndex("<your column name>"))更安全 -
是的,我试过列名是“数据”,类型是 BLOB。但我仍然有他同样的问题
标签: sqlite blackberry blob