当前位置:   article > 正文

sqlite 查看表结构 android.database.sqlite.SQLiteException: table splitTable has no column named_android.database.sqlite.sqliteexception: table boo

android.database.sqlite.sqliteexception: table book has no column named loca

Sqlite 插入数据数据时提示没有该列:

android.database.sqlite.SQLiteException: table splitTable has no column named isLast (code 1):  

此时可以查看该表的创建结构,然后调整列名称,重新调用插入的方法。

  1. Cursor cursor = db.rawQuery("select * from sqlite_master where type= 'table' and name='" + tableName + "'", null);
  2. /**
  3. * 查询到结果对应的列名与位置
  4. * 0 = "type"
  5. * 1 = "name"
  6. * 2 = "tbl_name"
  7. * 3 = "rootpage"
  8. * 4 = "sql"
  9. **/
  10. if (cursor.moveToNext()){
  11. String sql = cursor.getString(cursor.getColumnIndex("sql"));
  12. Log.d(TAG, "showCreateTable: sql " + sql);
  13. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/316501
推荐阅读
相关标签
  

闽ICP备14008679号