Android打开已有数据库查询
private SQLiteDatabase stuDb; /** * 查询数据库 * openOrCreateDatabase(数据库路径,数据库名) * rawQuery(Sql语句,参数) */ private void queryDatabase() { stuDb = SQLiteDatabase.openOrCreateDatabase(absolutePath + "/" + dbname, null); String trim = et_input.getText().toString().trim(); System.out.println(trim); Cursor rawQuery = stuDb.rawQuery("select * from article where id=?", new String[] { trim }); System.out.println(rawQuery.moveToFirst()); if (rawQuery.moveToFirst()) et_show.setText(rawQuery.getString(1)); }