需要简单的SQLite数据库的例子 [英] Need simple SQLite database example

查看:168
本文介绍了需要简单的SQLite数据库的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  在Android的 sqlite的示例程序

Possible Duplicate:
sqlite example program in android

我需要打开我的知道路径/名称,我需要读取一个已知值的数据库,并写入一个值。我不想写100行辅助类,我只是想使用的类/已经存在的功能。任何人都可以提供一个简单的例子吗?它真的不应该低于code几行也比较多。

I need to open a database where I know the path/name, I need to read a known value, and write a value. I don't want to write 100 line "helper classes," I simply want to use the classes/functions that already exist. Can anybody provide a a simple example for this? It really shouldn't be more than a few lines of code.

1:打开数据库:

也许这?的openDatabase(字符串路径,SQLiteDatabase.CursorFactory工厂,诠释标志)

maybe this? openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)

2:执行SQL显示值(举杯也许)

2: Execute SQL to display value (in a Toast perhaps)

3:关闭数据库

在我理解这个基本功能,然后,我会担心辅助类等等。在此先感谢。

Once I understand this basic functionality I will then worry about helper classes etc. Thanks in advance.

编辑:

魅力,每一个答案为止链接文章,做的正是我不愿做的事。我只是想如何直接打开一个数据库并从中读出一个简单的3线的例子。

Fascinating that every single answer so far links to articles that do EXACTLY what I asked not to do. I just want a simple 3 line example of how to directly open a database and read from it.

推荐答案

一个很好的SQLite 教程

A very good SQLite tutorial.

这篇关于需要简单的SQLite数据库的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆