Android 使用事物处理
发布日期:2021-06-30 22:34:59 浏览次数:2 分类:技术文章

本文共 516 字,大约阅读时间需要 1 分钟。

public class DBTransation {    public void transationTest(Context context){        DBHelper helper  = new DBHelper(context);        SQLiteDatabase db = helper.getWritableDatabase();        try {            db.beginTransaction();            db.execSQL("update book set price = price * 2 where id = ?", new Object[]{
"1"}); db.setTransactionSuccessful(); } catch (Exception e) { e.printStackTrace(); } finally{ db.endTransaction(); db.close(); } }}

转载地址:https://lovoo.blog.csdn.net/article/details/51223529 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Android 读取网络数据
下一篇:Android 创建DBHelper类

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2024年05月04日 21时47分17秒