samedi 26 mars 2016

after i update to Android 6.0 , sqlite DataBase crash

i use this code for working with sqlite.

before i update to android 6.0 its works excellent.

but now its crash.

in MyParam class

public static SQLiteDatabase dbMyCount;
public static String DB_Path_MyCount = "/sdcard/GMS/MyCount.db";

on MainActivity

MyParam.dbMyCount = this.openOrCreateDatabase(MyParam.DB_Path_MyCount, MODE_WORLD_WRITEABLE, null);
SQL  = "CREATE TABLE IF NOT EXISTS MyCount(_id INTEGER PRIMARY KEY AUTOINCREMENT,Tdate VARCHAR,Cust VARCHAR,";
SQL += "Prog VARCHAR,CustCode VARCHAR,OpenCode VARCHAR,Memo VARCHAR)";
MyParam.dbMyCount.execSQL(SQL);

i also update on my manifast this:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and i still got error:

Error Code : 1294 (SQLITE_CANTOPEN_ENOENT)
Caused By : Specified directory or database file does not exist.
(unknown error (code 1294): Could not open database)

I searched on web and could not find any answer or solution.

thanks

Aucun commentaire:

Enregistrer un commentaire