cursor常用於資料庫隨機讀寫時。
一些常用的cursor方法:
movetofirst()
//移動游標到第一行
movetolast()
//移動游標到最後一行
movetonext()
//移動游標到下一行
movetoposition(int position)
//移動游標到乙個絕對的位置
movetoprevious()
//移動游標到上一行
copystringtobuffer(int columnindex, chararraybuffer buffer)
//在緩衝區中檢索請求的列的文字,將將其儲存
getcolumncount()
//返回所有列的總數
getcolumnindex(string columnname)
//返回指定列的名稱,如果不存在返回-1
getcolumnindexorthrow(string columnname)
//從零開始返回指定列名稱,如果不存在將丟擲illegalargumentexception 異常。
getcolumnname(int columnindex)
//從給定的索引返回列名
getcolumnnames()
//返回乙個字串陣列的列名
getcount()
//返回cursor 中的行數
close()
//關閉游標,釋放資源
Android中cursor類的使用
android中從資料庫中查出來的資料一般都存在cursor中即 cursor mcursor msqlitedatabase.query select form table null 說白了就是乙個資料集合,具體的說就是每行資料集合,下面是api中對cursor的解釋 關於 cursor,1,cu...
Android中cursor類的使用
android中從資料庫中查出來的資料一般都存在cursor中即 cursor mcursor msqlitedatabase.query select form table null 說白了就是乙個資料集合,具體的說就是每行資料集合,下面是api中對cursor的解釋 關於 cursor,1,cu...
Android中的 Cursor 類總結
cursor是把查詢到的結果集封裝在乙個cursor物件當中。cursor就像是結果集上的乙個游標,可以向前向後移動。取出cursor中的資料一般是用 while cursor.movetonext 很多時候,不要忘記movetofirst 一般都是從第一行開始取值 移動到需要的行的時候,根據下標來...