[英]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.