i have been create Database using SQlite Manager (Mozila adds-on), then import some data from csv file then i export the database.
When i import the database into android emulator, database imported successfully. But, when i run some query, then error has appeared file is encrypted or is not a database this my code:
public Cursor getTestData()
{
    try
    {
        String sql ="SELECT * FROM `mlokasi` WHERE _id = 1";
         Cursor mCur = myDataBase.rawQuery(sql, null);
        if (mCur!=null)
        {
           mCur.moveToNext();
        }
        return mCur;
    }
    catch (SQLException mSQLException)
    {
        Log.e("Exception", "getTestData >>"+ mSQLException.toString());
        throw mSQLException;
    }
}
Then called the method, something like this:
Cursor testdata = myDbHelper.getTestData();
        if (testdata.moveToFirst()) {
            do {
                Log.d("kab", testdata.getString(0));
            } while (testdata.moveToNext());
        }
What's wrong? Please help, thanks
 
Aucun commentaire:
Enregistrer un commentaire