public String getCourse_info (String courseID) {
String[] columns = new String[] {KEY_COURSE_ID, KEY_COURSE_TITLE, KEY_COURSE_CNUMBER, KEY_COURSE_SUBJECT, KEY_COURSE_DAYS,
KEY_COURSE_START_TIME, KEY_COURSE_END_TIME, KEY_COURSE_PROFESSOR, KEY_COURSE_BUILDING, KEY_COURSE_ROOM_NUMBER };
Cursor c = ourDataBase.query(DATABASE_TABLE_COURSES, columns, KEY_COURSE_ID + "=?", new String[]{courseID}, null, null, null);
String result = "";
int iCid = c.getColumnIndex(KEY_COURSE_ID);
int iCtitle = c.getColumnIndex(KEY_COURSE_TITLE);
int iCcnumber = c.getColumnIndex(KEY_COURSE_CNUMBER);
int iCsubject = c.getColumnIndex(KEY_COURSE_SUBJECT);
int iCdays = c.getColumnIndex(KEY_COURSE_DAYS);
int iCstart_time = c.getColumnIndex(KEY_COURSE_START_TIME);
int iCend_time = c.getColumnIndex(KEY_COURSE_END_TIME);
int iCprofessor = c.getColumnIndex(KEY_COURSE_PROFESSOR);
int iCbuilding = c.getColumnIndex(KEY_COURSE_BUILDING);
int iCroom_number= c.getColumnIndex(KEY_COURSE_ROOM_NUMBER);
for(c.moveToFirst(); !c.isAfterLast();c.moveToNext()){
result = result + c.getString(iCid)+ " " +c.getString(iCtitle)+ " "+c.getString(iCcnumber)+" "+ c.getString(iCsubject) + " "+
c.getString(iCdays)+ " "+ c.getString(iCstart_time)+ " "+ c.getString(iCend_time) +" " +
c.getString(iCprofessor) + " "+ c.getString(iCbuilding) + " " + c.getString(iCroom_number)+ "\n" ;
}
Log.d("hello", result+"test2");
return result;
}
OK、データベースのテーブルの 1 つでこのコードを実行しようとしています。データベースで最初の course_id を渡すと、完全に機能します。しかし、その後に 2nd または course_id を入力しようとすると、文字列に何も表示されません。