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)); }
时间: 2024-10-12 20:22:53