views:

397

answers:

5

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?

+2  A: 

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).

Thorsten Dittmar
check out i had edited my ques..
Praveen Chandrasekaran
Well, same reply, other column name...
Thorsten Dittmar
As Thorsten said, make sure you have the correct table schema in your database . From the link above, have a look at the section "Examining sqlite3 Databases from a Remote Shell"
ccheneson
+1  A: 

checkout there exists column "linkweb" in your table

Vishal
A: 

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.

dtmilano
A: 

i think that there is not any column name linkweb.

Atul Yadav
A: 

i think you are missing space after writing text