Sqlite数据库检索多条数据
在 sqLite 中,我从活动中将 3 个值插入到数据库的表中。 我需要从数据库、另一个活动中检索这 3 个值...可以从表中检索第一个值...我无法检索其余 2 个值...如何定义游标对象来执行以下操作相同的???
myDB = MyService.this.openOrCreateDatabase("antitheft", MODE_PRIVATE, null);
Cursor cursor1 = myDB.query("SimSerial", null, null, null, null, null, null);
cursor1.moveToLast();
String ss1 = cursor1.getString(cursor1.getColumnIndex("simno"));
cursor2.moveToFirst();
String num1 = cursor2.getString(cursor2.getColumnIndex("secure"));
In sqLite,i have 3 values inserted in a table in my database ,from an activity.
I need to reteive those 3 values from the database,from another activity...The retreival of the first value from the table is possible..i cant retreive the remaining 2 values...How can the cursor object be defined to do the same???
myDB = MyService.this.openOrCreateDatabase("antitheft", MODE_PRIVATE, null);
Cursor cursor1 = myDB.query("SimSerial", null, null, null, null, null, null);
cursor1.moveToLast();
String ss1 = cursor1.getString(cursor1.getColumnIndex("simno"));
cursor2.moveToFirst();
String num1 = cursor2.getString(cursor2.getColumnIndex("secure"));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以编写查询来选择所有记录,然后迭代记录。
You can write the query for selecting all the records and then iterate through the records.
您需要迭代游标。为此,您可以使用以下示例。
You need to iterate cursor. For that you can use following example.