Praveen
Praveen

Reputation: 91205

getting sqlite exception when insert ? how to?

i created the database like this

db.execSQL("CREATE TABLE "+TABLE_NAME+" (" 
    +_ID+" INTEGER PRIMARY KEY AUTOINCREMENT," 
    + TITLE+" TEXT UNIQUE," 
    + PUBLISHED+" DATETIME," 
    + CONTENT+" TEXT," 
    + RATERS+" TEXT,"
    + VIEWCOUNT+" TEXT,"
    + THUMBNAIL+" TEXT,"
    + FAVCOUNT+" TEXT,"
    + FAVSTAT+" INTEGER,"
    + LINKWEB+" TEXT);");

i got an exception when i try to insert the values in the table??

02-24 15:57:37.802: ERROR/DatabaseUtils(283): Writing exception to parcel
02-24 15:57:37.802: ERROR/DatabaseUtils(283): android.database.sqlite.SQLiteException: table bru_tube has no column named linkweb: , while compiling: INSERT INTO bru_tube(content, favstat, title, thumbnail, linkweb, raters, viewcount, published, favcount) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?);
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteProgram.native_compile(Native Method)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:110)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1026)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1412)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1307)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at com.brownuniv.brutube.BruTube_Provider.insert(BruTube_Provider.java:82)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.content.ContentProvider$Transport.insert(ContentProvider.java:150)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:140)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at android.os.Binder.execTransact(Binder.java:287)
02-24 15:57:37.802: ERROR/DatabaseUtils(283):     at dalvik.system.NativeStart.run(Native Method)

how to solve it??? any idea?

Upvotes: 0

Views: 2267

Answers (5)

user286919
user286919

Reputation: 49

i think you are missing space after writing text

Upvotes: 0

Atul Yadav
Atul Yadav

Reputation: 496

i think that there is not any column name linkweb.

Upvotes: 0

Diego Torres Milano
Diego Torres Milano

Reputation: 69416

Use sqlite3 from command line on the emulator or on your desktop to verify that what you are trying to achieve is correct and has no syntax errors. Also verify the schema after table creation.

Upvotes: 0

Vishal Khakhkhar
Vishal Khakhkhar

Reputation: 2116

checkout there exists column "linkweb" in your table

Upvotes: 1

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56737

Are you sure that the LINKWEB variable also contains the text "linkweb"? Maybe a spelling mistake. You can use ADB to connect to the emulator and view the database - maybe that helps (see this document).

Upvotes: 3

Related Questions