赞
踩
Sqlite 插入数据数据时提示没有该列:
android.database.sqlite.SQLiteException: table splitTable has no column named isLast (code 1):
此时可以查看该表的创建结构,然后调整列名称,重新调用插入的方法。
- Cursor cursor = db.rawQuery("select * from sqlite_master where type= 'table' and name='" + tableName + "'", null);
- /**
- * 查询到结果对应的列名与位置
- * 0 = "type"
- * 1 = "name"
- * 2 = "tbl_name"
- * 3 = "rootpage"
- * 4 = "sql"
- **/
- if (cursor.moveToNext()){
- String sql = cursor.getString(cursor.getColumnIndex("sql"));
- Log.d(TAG, "showCreateTable: sql " + sql);
- }
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。