Home > Mobile >  Run android project always quote (1) no to the table: Data_table errors
Run android project always quote (1) no to the table: Data_table errors

Time:09-22

I was written according to the external database and then import the database steps into the assets folder but has been submitted to the error is can't find the form I put the database file export is to have the table I put the code for find android_metadata (online is the default table) won't go wrong this time table can be found online for all kinds of methods will work
This is the query button code single-step tracking to Cursor Cursor=database. The rawQuery (SSQL, null); This step will go wrong and that is the error message when
 public void onClick (View v) {
The switch (v.g etId ()) {
Case R.i db utton3:
Zhiling=etext. GetText (). The toString ();
The text. The setText (zhiling);
SQLiteDatabase database=SQLiteDatabase. OpenDatabase (DB_PATH + DB_NAME, null, SQLiteDatabase. OPEN_READONLY);
String SSQL="select * from" + "where" + + KEY_shuju KEY_name + "='" + zhiling +"' ";
Cursor Cursor=database. RawQuery (SSQL, null);
If (cursor!=null & amp; & Cursor. GetCount () & gt; 0 {
While (cursor. MoveToNext ()) {
Jieguo=cursor. Get string (cursor. GetColumnIndex (" neirong "));
}
Text2. SetText (jieguo);
}
The else {
Text. SetText (" there is no this instruction!" );
Text2. SetText (" ");
}
break;
Case R.i db utton4:
Etext. SetText (" ");
Text2. SetText (" ");
The text. The setText (" ");
break;
}
}

CodePudding user response:

Top a downstairs there is a strange place is I won't an error in my mobile phone really during normal operation when I packed into apk change a mobile phone and I later will be an error with the virtual equipment

CodePudding user response:

That is the bug of the simulator, all will be subject to real machine,

CodePudding user response:

refer to the second floor of the kite runner reply:
that is the bug of the simulator, all will be subject to real machine,
suggest another with sqlitehelper management database

CodePudding user response:

refer to the second floor of the kite runner reply:
is the bug of the simulator, all will be subject to real machine,
but if use someone phone installation error will flash back and on the simulator directly as the only used real machine debugging is my cell phone use has been won't be a problem no matter how to delete won't be a problem

CodePudding user response:

Direct reference to the asset directory didn't try, try to database export to the external directory? Such as context. GetExternalFilesDir, it is possible that the database version is not the same,,,

CodePudding user response:

May be a database format is not compatible, some large database vendors provide Java has its own underlying implementation, need to import the database takes the operation of the library,
  • Related