教師の名前を検索し、ユーザーが教師の名前を入力したときにそれに関するすべての情報を表示する必要があります
このコードを書きましたが、実行時エラーが発生しました。このエラーは次のとおりです。FATAL EXCEPTION: main
これは GetRecord メソッドです
public Cursor getRecord(String n1) throws SQLException
{
Cursor mCursor =db.query(true, databaseName, new String[] {facultyc,
deparmentc, namec, officeNumberc,Phonec ,emailAddressc,officeHourc},namec + "=" + n1, null, null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
この検索方法は、ユーザーが検索ボタンをクリックしたときに実行されます
public void search(){
db.open();
Cursor c = db.getRecord(n);
if (c.moveToFirst()){
t1.setText(c.getString(0));
t2.setText(c.getString(1));
t3.setText(c.getString(2));
t4.setText(c.getString(3));
t5.setText(c.getString(4));
t6.setText(c.getString(5));
t7.setText(c.getString(6));
}
else
Toast.makeText(this, "this Dr not found", Toast.LENGTH_LONG).show();
db.close();
}
このエラーが表示されます
05-04 13:39:52.856: E/Trace(4001): トレース ファイルを開く際のエラー: そのようなファイルまたはディレクトリはありません (2)