关键代码

      SQLiteDatabase db = myDataHelper.getWritableDatabase();
            // 开启事务
            db.beginTransaction();
            try{
                db.delete("book", null, null);
                if(true){
                    throw new NullPointerException();
                }
                db.execSQL("INSERT INTO book(name, author, pages, price) VALUES(?,?,?,?)",
                        new String[]{"qihuanzhilv2", "daxiao", "500", "10.50"});
            }catch (Exception e){
                e.printStackTrace();
            }finally {
		//结束事务
                db.endTransaction();
            }

  

相关文章:

  • 2022-12-23
  • 2021-11-19
  • 2021-05-19
  • 2021-07-18
  • 2021-06-26
  • 2021-09-02
  • 2021-10-07
  • 2021-11-11
猜你喜欢
  • 2021-08-18
  • 2021-07-14
  • 2022-12-23
  • 2022-02-02
  • 2021-06-02
  • 2021-06-29
  • 2021-12-18
相关资源
相似解决方案