Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logcat错误地说SQLite数据库-Android SQLite中没有这样的列_Android_Sqlite_Logcat - Fatal编程技术网

Logcat错误地说SQLite数据库-Android SQLite中没有这样的列

Logcat错误地说SQLite数据库-Android SQLite中没有这样的列,android,sqlite,logcat,Android,Sqlite,Logcat,在这个Logcat的顶部,它表示没有name==Ben10的列。然而,在这个Logcat的底部,我用他们的imagePath、id、name和password记录了用户。Ben10a表示带有密码a的名称Ben10。所以有一列的名字是Ben10 12-31 02:05:10.195: D/dalvikvm(1091): GREF has increased to 201 12-31 02:05:16.105: E/dbHelper(1091): SELECT * FROM AppUser

在这个Logcat的顶部,它表示没有name==Ben10的列。然而,在这个Logcat的底部,我用他们的imagePath、id、name和password记录了用户。Ben10a表示带有密码a的名称Ben10。所以有一列的名字是Ben10

12-31 02:05:10.195: D/dalvikvm(1091): GREF has increased to 201
    12-31 02:05:16.105: E/dbHelper(1091): SELECT  * FROM AppUser WHERE name = Ben10
    12-31 02:05:16.105: E/SQLiteLog(1091): (1) no such column: Ben10
    12-31 02:05:16.235: D/Get database Items(1091): Getting all database items
    12-31 02:05:16.245: E/dbHelper(1091): SELECT  * FROM ClothingItem
    12-31 02:05:16.256: E/dbHelper(1091): SELECT  * FROM AppUser
    12-31 02:05:16.256: D/ClothingItem(1091): 1hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 2hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 3hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 4hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 5hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 6hathat1
    12-31 02:05:16.275: D/ClothingItem(1091): 7hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 8hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 9hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 10hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 11hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 12hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 13hathat1
    12-31 02:05:16.285: D/ClothingItem(1091): 14hathat1
    12-31 02:05:16.285: D/User(1091): content://media/external/images/media/121Bena
    12-31 02:05:16.285: D/User(1091): content://media/external/images/media/122Ben10a
    12-31 02:05:16.315: D/dalvikvm(1091): GC_CONCURRENT freed 140K, 2% free 12075K/12295K, paused 72ms+30ms, total 164ms

在这种情况下,[num,name,typ,notnull,comment]表示列,下面表示类似[1,2,3,4,5]或[id,ref,created,modified,name]的值

在您的情况下,
Logcat show E/SQLiteLog(1091):(1)没有这样的列:Ben10
所以你需要检查你的SQL是正确的

也许你用

SELECT  * FROM AppUser WHERE Ben10 = xxxxx so that will be crash

在sql查询中使用撇号括起字符串。 所以试试这个:

select * from AppUser where name = 'Bem10'

Ben10是值,name是列,所以没有这样的列:Ben10是correct@henry4343是的,这只是SQLite奇怪的日志。我很确定它在“名称”列中没有这样的值Ben10。如果您确定这一点,请发布您的活动代码。@henry4343在该日志中,我认为该列表示数据库中的一行(一个条目)。什么?专栏不是你们所说的,它叫做记录。我对专栏并不感到困惑。这是创建我的AppUser表的语句的日志:
12-31 02:29:22.125:D/create USER table(1158):create table AppUser(id integer主键自动递增,imagePath文本,name文本,password文本)
问题是,SQLite在找不到键为:name,值:Ben10但在您的Logcat print E/SQLiteLog(1091)中:(1)没有这样的列:Ben10表示您使用列Ben10来查询数据。可能您需要检查您的SQL语法…可能您可以发布您的SQL语法或表数据。我将SQL语法记录在原始Logcat中。我还将数据记录在该Logcat的数据库中。语法是
12-31 02:29:30.679:E/dbHelper(1158):SELECT*FROM AppUser WHERE name=Ben10
@grennis Lol我知道Logcat没有错,但在除夕夜处理了一段时间的错误后,不幸的是,选择一个更好的问题名称有时会被放在后台。我只是在想“他们会知道我的意思的”。哈哈。@user2602079这个问题没有引起太多注意的原因可能是您没有提供源代码。