如何将现有的MS访问端口到SQLite用于android应用程序开发? [英] How to port an existing MS Access to SQLite for use with android app developement?

查看:132
本文介绍了如何将现有的MS访问端口到SQLite用于android应用程序开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何在Android中将MDB转换为SQLite


我有一个MS访问数据库,几乎没有表和相当多的数据。我想知道是否有可能将所有这些表转移到sqlite,用于正在开发的Android应用程序。



感谢您的时间

解决方案

最简单的方法是将每个表导出为CSV,然后使用某种SQLite工具将这些表导入到您的DQLite数据库中。我使用 SQLite专家



然后您需要



1)数据库必须包含一个名为android_metadata的表,

2)此表必须具有locale列

3)表中应有一个值为en_US的记录

4)每个表的主键需要调用_id(这样Android就知道在哪里绑定表的id字段)



资源文件夹中的数据库,当您的应用开始将其复制到您的应用数据目录。



此复制过程的好链接是此处



您也可以使用 SQLiteAssetHelper 来处理从资源到数据目录的数据库传输,而不是教程显示如果你觉得需要的方式。 / p>

Possible Duplicate:
How to convert MDB to SQLite in Android

I have an MS access database with few tables and quite a bit of data in it. I was wondering if it is possible for me to port all those tables over to sqlite for an android app that I am developing.

Thanks for your time

解决方案

The easiest way would be to export each table to CSV and then use an SQLite tool of some sort to import those tables into your DQLite database. I use SQLite Expert.

Then you would need to make some modifications to that database and those tables to make it usable by Android to populate listviews and other widgets.

1) The database must contain a table called "android_metadata"
2) This table must have the column "locale"
3) There should be a single record in the table with a value of "en_US"
4) The primary key for every table needs to be called "_id" (this is so Android will know where to bind the id field of your tables)

Then you put the DB in your assets folder and when your app starts copy it to your apps data directory.

A good link for this copying process is here.

You could also use SQLiteAssetHelper to handle the transfer of the DB from assets to your data directory instead of doing the way the tutorial shows if you felt the need.

这篇关于如何将现有的MS访问端口到SQLite用于android应用程序开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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