Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何反向读取sql数据库_Java_Android_Sql_Database_Eclipse - Fatal编程技术网

Java 如何反向读取sql数据库

Java 如何反向读取sql数据库,java,android,sql,database,eclipse,Java,Android,Sql,Database,Eclipse,嘿,伙计们,我有一个问题:我怎样才能从后面读取数据库? 这是我读取文件的方法: Cursor cursor = myDb.getAllRows(); // Allow activity to manage lifetime of the cursor. // DEPRECATED! Runs on the UI thread, OK for small/short queries. startManagingCursor(cursor); // Setup mapping from curs

嘿,伙计们,我有一个问题:我怎样才能从后面读取数据库? 这是我读取文件的方法:

Cursor cursor = myDb.getAllRows();

// Allow activity to manage lifetime of the cursor.
// DEPRECATED! Runs on the UI thread, OK for small/short queries.
startManagingCursor(cursor);

// Setup mapping from cursor to view fields:
String[] fromFieldNames = new String[] 
        {DBAdapter.KEY_KALO, DBAdapter.KEY_HYDRATE, DBAdapter.KEY_FAT, DBAdapter.KEY_PROTEIN ,DBAdapter.KEY_CAL};
int[] toViewIDs = new int[]
        {R.id.item_Kalorien,     R.id.item_KG_in_g,           R.id.item_F_in_g,     R.id.item_P_in_g,R.id.item_cal};

// Create adapter to may columns of the DB onto elemesnt in the UI.
SimpleCursorAdapter myCursorAdapter = 
        new SimpleCursorAdapter(
                this,       // Context
                R.layout.item_tagebuch, // Row layout template
                cursor,                 // cursor (set of DB records to map)
                fromFieldNames,         // DB Column names
                toViewIDs               // View IDs to put information in
                );

// Set the adapter for the list view
ListView myList = (ListView) findViewById(R.id.listView1);
myList.setAdapter(myCursorAdapter);

谢谢你的帮助!:)

您必须将查询方法的konstructor更改为Desc

@Josef E。您能在这里帮助我吗?;)