使用多个表使用rawquery查询列表活动?

时间:2012-01-10 01:23:19

标签: android sql database eclipse

基本上我在我的数据库中有两个表与一个rawQuery和一个ListActivity一起使用,它应该从两个表中提取信息并在ListActivity中显示它。我没有关闭力量或任何问题是信息没有出现。

我的RAWQUERY

public Cursor fetchName() {
    return ourdb.rawQuery("SELECT wwJobTable._id, wwJobTable.JobName, wwLatLonTable.JobLatitude FROM wwJobTable, wwLatLonTable WHERE wwLatLonTable.JobLatitude=wwJobTable.JobCode", null);
}

我如何查看表格信息

private void fillData() {
     // Get all of the rows from the database and create the item list

    mTimeNotesCursor = mDbHelper.fetchName();
    mTimeNotesCursor.moveToFirst();
    startManagingCursor(mTimeNotesCursor);

    // Create an array to specify the fields we want to display in the list (only TITLE)
    String[] from = new String[]{WWDatabase.KEY_JOBNAME,
            WWDatabase.KEY_LATITUDE};

    // and an array of the fields we want to bind those fields to (in this case just text1)
    int[] to = new int[]{R.id.textView1, R.id.textView2};

    // Now create a simple cursor adapter and set it to display
    SimpleCursorAdapter notes = 
        new SimpleCursorAdapter(this, R.layout.time_text_row, mTimeNotesCursor, from, to);

    setListAdapter(notes);
}

我可能做错了什么?

0 个答案:

没有答案