简体   繁体   English

SQLiteAssetHelper-如何使用AssetHelper将新数据插入现有数据库?

[英]SQLiteAssetHelper - how to insert new data to existing database with AssetHelper?

I'm currently coding an android application. 我目前正在编写一个android应用程序。 To read a pre-existing database, I use the SQLiteAssethelper . 要读取现有数据库,请使用SQLiteAssethelper It works all fine but can anyone tell me how I can insert data with the SQLiteAssethelper ? 一切正常,但是谁能告诉我如何使用SQLiteAssethelper插入数据? Thank you! 谢谢!

Try this: 尝试这个:

SQLiteDatabase mDb=getWritableDatabase();
ContentValues values = new ContentValues();
values.put("column_1", "value_1");
values.put("column_2", "value_2");
long insert_result = mDb.insert(dbSchema.table_name, null, values);
mDb.close();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将新列或表添加到资源中预先填充的sqlite数据库并使用SQLiteAssetHelper - How to add a new column or table to sqlite database pre-populated in the assets and using SQLiteAssetHelper 继续在 Android 的 Firebase 数据库中的现有数组中插入新数据 - Continue insert new data in existing array in Firebase Database from Android 如何从特定的行SQLiteAssetHelper检索数据 - How to retrieve data from specific row SQLiteAssetHelper 使用SQLiteAssetHelper写入数据库 - Writing to a Database Using SQLiteAssetHelper 如何向 Firebase 实时数据库中的现有数据添加新属性? - How to add new attributes to existing data in Firebase Realtime Database? 如何在现有xml文件中插入新节点 - How to insert new node in a existing xml file 将新数据插入数据库中的特定表 - Insert new data into specific table in a the database 将当前数据库条目与要插入的新数据同步 - synchronizing current database entries with new data to insert 在assests文件夹中的现有sqlite数据库中插入数据,将其删除,检索数据 - Insert, Delete, Retrieve data from and into existing sqlite database in assests folder Android应用程序将位置数据插入到现有的msql数据库中 - Android app to insert location data into existing msql database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM