sqlite - Android SQLight Insert -


i have following table configuration

    package com.lynas.entertainmenttracker; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper;  public class dbconnectiontablemovie {     public static final string dbname = "entertainment_tracker";     public static final string dbtable = "movie";     public static final int version = 1;      public static final string dbcreate_movie = "create table movie(" +             "movie_id integer primary key autoincrement, " +             "movie_name varchar, " +             "movie_release_date date, " +             "movie_extra varchar)";      private final context context;     private dbhelper dbh;     private sqlitedatabase db;      public dbconnectiontablemovie(context ctx){          this.context = ctx;         dbh = new dbhelper(context);     }       private static class dbhelper extends sqliteopenhelper{          dbhelper(context context){             super(context, dbname,null,version);         }           @override         public void oncreate(sqlitedatabase db) {             //try{                 db.execsql(dbcreate_movie);             //}catch(sqlexception e){                 //e.printstacktrace();             //}          }          @override         public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {             db.execsql("drop table movie if exists");             oncreate(db);          }      }     public dbconnectiontablemovie open() throws sqlexception{         db = dbh.getwritabledatabase();         return this;     }      public void close() throws sqlexception{         dbh.close();     }      public void addanewrow(string inserquery){         db.execsql(inserquery);     }     public void updaterow(string updatequery){         db.execsql(updatequery);     }     public void deleterow(string deletequery){         db.execsql(deletequery);     }     public cursor selectrow(string selectquery){         return db.rawquery(selectquery, null);     }   } 

i not sure if relevant or not used same database name table public static final string dbname = "entertainment_tracker";

i trying insert row using following query creating object of class. in activity used constructor

dbconnectiontablemovie dbcon = new dbconnectiontablemovie(this); string insertanewmovie = "insert movie values (null, 'name', '2013-05-01', 'empty')";  dbcon.open(); dbcon.addanewrow(insertanewmovie); dbcon.close(); 

i getting table not exist error. can tell me whats wrong?

error log

05-14 00:24:18.366: e/database(856): failure 1 (no such table: movie) on 0x259138 when preparing 'insert movie values (null, 'jack', '2013-05-14', 'empty')'.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -