I am writing an Android application and am trying to store my data in DB. I get an error at any time:
"Table Manager does not have a profile, Profile_Pic_Url"
I have gone to all such posts and Tried to "uninstall and reinstall" and "clear data" but did not work.
Here is my code:
package com.example.groupchat; Import android.content.ContentValues; Import android.content.Context; Import android.database.Cursor; Import android.database.sqlite.SQLiteDatabase; Import android.database.sqlite.SQLiteOpenHelper; Public Class Meadabase extends SQLiteOpenHelper {// Definition Database's personal static final end DATABASE_VERSION = 1; Private static final string DATABASE_NAME = "AppInformation"; // Definition of the table Personal Stable Last String Table_ NAME = "Friend_Master"; // Region Definitions Private Stable Last String ID = "F_ID"; Stable final string firstname = "FIRST_NAME"; Private Stable Last String LastName = "LAST_NAME"; Private Static Last String DisplayName = "DISPLAY_NAME"; Private Static Last String Profile PICUrl = "Profile_Pic_Url"; Public MadeBasebase (Reference Reference) {Super (Reference, DatabaseNNAn, Blank, Databasebysons); } @ Override Public Wide on Crate (SQLiteDatabase db) {db.execSQL ("DROP TABLE if present" + TABLE_NAME); // Testing purpose only String CreateTable = "create tab" + TABLE_NAME + "(" + + + + + + + + + + + Primary + "text," + Last name + "text," + DisplayName + "text," + Profile + PICUrl + "text" + ");" ; Db.execSQL (createTable); } @ Override Upgrade to Public Zero (SQLiteDatabase db, int arg1, int arg2) {db.exec SQL ("empty tab if existing" + TABLE_NAME); OnCreate (database); } Public Zero InsertInformation Database (friend information information) {SQLiteDatabase db = this.getWritableDatabase (); Content value cv = new content value (); Cv.put (id, info.getID ()); Cv.put (first name, info.getFirst_Name ()); Cv.put (LastName, info.getLast_Name ()); Cv.put (DisplayName, info.getDisplay_Name ()); Cv.put (ProfilePicUrl, info.getProfile_Pic_Url ()); Db.insert (TABLE_NAME, Faucet, CV); Db.close (); } Public friend information getInformationFromDatabase (string _id, string first_name) {SQLiteDatabase db = this.getReadableDatabase (); String query = "SELECT * FROM" + TABLE_NAME + "WHERE" + ID + "= \" "+ _ID +" \ "and" + FirstName + "= \" "+ first_name +" \ ""; Cursor cursor = db.rawQuery (query, empty); If (cursor.moveToFirst ()) {cursor.moveToFirst (); Friend Information Info = New Friend Information (cursor.greatstrings (0), cursor.greatstring (1), cursor.greatstrings (2), cursor.greatstring (3), cursor.txt string (4)); Return information; } Return tap; } Public friend information getInformationFromDatabase (string display_name) {SQLiteDatabase db = this.getReadableDatabase (); String query = "SELECT * FROM" + TABLE_NAME + "WHERE" + DisplayName + "= \" "+ Display_Name +" \ ""; Cursor cursor = db.rawQuery (query, empty); If (cursor.moveToFirst ()) {cursor.moveToFirst (); Friend Information Info = New Friend Information (cursor.greatstrings (0), cursor.greatstring (1), cursor.greatstrings (2), cursor.greatstring (3), cursor.txt string (4)); Return information; } Return tap; }}
I do not understand where I am going ...
You do not forget to add a location between the column name ProfilePicUrl
and the column type. Add space between the two:
String CreateTable = "Create Tab" + TABLE_NAME + "(" + + + + + + + "+ Primary Key Text," + First Name + "Text," + Last name + "text," + DisplayName + "TEXT," + ProfilePicUrl + "TEXT" + ");";
The best option to avoid these types of mistakes
Comments
Post a Comment