English 中文(简体)
roid-从qlite数据库中记录
原标题:android _Displaying a record from a sqlite database

我计划制作一个数据,让用户从一个特定数据库中选择记录,例如:

               name    favorite_color       favorite_team  
               sue        red                  Dal
               mike       blue                 Mia
               sam        purple               Bal

My problem is that most of the tutorials that I have come across only demonstrates examples using a table with one column. What if my pre-populated database more then on column? What if it had 100 columns? Does anyone know how this is done?????

问题回答

例如:

步骤1:DeclarekouiteDatabase,Declare Databasehelper

步骤2:将标记或编号用作钥匙或使其成为意图(例如增长)

步骤3:在“网上”方法中,添加类似于以下的编码线:

        String query="select * from my_table_name where _id="+rowid;
        Cursor myCursor = database.rawQuery(query,null);
        myCursor.moveToFirst();
        //This line implies i am getting data from column four of selected row
        String x=myCursor.getString(4);
        //This line implies i am getting data from column two of selected row
        String y=myCursor.getString(4);
        myCursor.close();

Note: a)Don t forget that your database size must not exceed 1.2mb

b) 包括一个名称栏,每个表格的自动安装可使用qlite浏览器。

c) 还在贵数据库中设立以下表格:

CREATE TABLE "android_metadata" ("locale" TEXT DEFAULT  en_US )

现在,在“Rodid_metadata”表中插入一行,其文本为_US

INSERT INTO "android_metadata" VALUES ( en_US )

this。 获取散射信息的另一个途径是使用类似于点燃的口服避孕药。 I m在i ve开发的各种器具中使用,而且使用简单。





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签