Why The Database Can Not Be Known In Android Sqlite?
I'm making an application Maps connected with SQLite which there are markers, but there is an error that the database can not be recognized, why did it happen? Can anybody help me?
Solution 1:
marker.db
as a table name tells to look up a table name db
in database marker
and you don't have the database marker
attached.
Either write the table name in double quotes like "marker.db"
, or better yet, rename the table to something that better resembles whatever you're putting in there, without a .
.
Solution 2:
Marker.db
should be the name of your database and you should pass it in your constructor. The name of your table should be simply Marker
:
publicclassMaBaseextendsSQLiteOpenHelper {
privatestaticfinalStringDB_MARK="marker.db";
privatestaticfinalStringTABLE_MARK="marker";
privatestaticfinalStringCOL_ID="ID";
privatestaticfinalStringCOL_LONG="LONGITUDE";
privatestaticfinalStringCOL_LAT="LATITUDE";
privatestaticfinalStringCREATE_BDD="CREATE TABLE " + TABLE_MARK + " ("
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_LONG + " TEXT NOT NULL, " +COL_LAT+" TEXT NOT NULL);";
publicMaBase(Context context, String name, CursorFactory factory, int version) {
super(context, DB_MARK, factory, version);
}
@OverridepublicvoidonCreate(SQLiteDatabase db) {
//on créé la table à partir de la requête écrite dans la variable CREATE_BDD
db.execSQL(CREATE_BDD);
}
...
Post a Comment for "Why The Database Can Not Be Known In Android Sqlite?"