开发者

Need simple SQLite database example [duplicate]

This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

sqlite example program in android

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: Open database:

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

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

3: Close 开发者_开发技巧database

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

EDIT:

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.


A very good SQLite tutorial.


Run through the notepad tutorial

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜