android - Why is Logcat showing "E/SQLiteLog﹕ (1) no such table: reg_info"? -
i changed database version, added appropriate amount of spaces sql function create table , updated parameters function inserts input database, logcat still displays:
e/sqlitelog: (1) no such table: reg_info e/sqlitedatabase: error inserting user_password=e user_email=e user_name=e while compiling: insert reg_info(user_password,user_email,user_name)
i condensed information displayed errors focus on these specific errors. problem occurs on emulator , android devices. thank you.
this contract class declared columns table:
package com.example.xxx.datadigger; import android.provider.basecolumns; public final class tabledata { public tabledata() { } public static abstract class tableinfo implements basecolumns { public static final string database_name="user_info"; public static final string table_name="reg_info"; public static final string key_id = "id"; public static final string user_name = "user_name"; public static final string user_password = "user_password"; public static final string user_con = "user_con"; public static final string user_email = "user_email"; } }
here attempt create table , insert data insert:
package com.example.xxx.datadigger; import android.app.actionbar; import android.content.contentvalues; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; import android.widget.tabwidget; public class databaseoperations extends sqliteopenhelper{ public static final int database_version = 2; private static final string text_type = " text"; private static final string comma_sep = ", "; private static final string create_query = "create table " + tabledata.tableinfo.table_name + " (" + tabledata.tableinfo.key_id + " integer primary key autoincrement, " + tabledata.tableinfo.user_email + text_type + comma_sep + tabledata.tableinfo.user_name + text_type + comma_sep + tabledata.tableinfo.user_password + text_type + comma_sep + "); "; public databaseoperations(context context) { super(context, tabledata.tableinfo.database_name, null, database_version); log.d("database operations", "database created"); } @override public void oncreate(sqlitedatabase sdb) { sdb.execsql(create_query); log.d("database operations","table created"); } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { } public void putinformation(databaseoperations dop, string name,string password,string email) { sqlitedatabase sq = dop.getwritabledatabase(); contentvalues cv = new contentvalues(); cv.put(tabledata.tableinfo.user_email, email); cv.put(tabledata.tableinfo.user_name,name); cv.put(tabledata.tableinfo.user_password, password); //cv.put(tabledata.tableinfo.user_con,con_password); sq.insert(tabledata.tableinfo.table_name, null, cv); log.d("database operations","one raw inserted"); } }
your onupgrade()(after version number increased) method empty if table not created during oncreate()(first time db gets created) never created , same error thrown. saying created space increased version , trying never workout.
try uninstalling app , re-inistall in existing code.
Comments
Post a Comment