<i id='ZsOyD'><tr id='ZsOyD'><dt id='ZsOyD'><q id='ZsOyD'><span id='ZsOyD'><b id='ZsOyD'><form id='ZsOyD'><ins id='ZsOyD'></ins><ul id='ZsOyD'></ul><sub id='ZsOyD'></sub></form><legend id='ZsOyD'></legend><bdo id='ZsOyD'><pre id='ZsOyD'><center id='ZsOyD'></center></pre></bdo></b><th id='ZsOyD'></th></span></q></dt></tr></i><div id='ZsOyD'><tfoot id='ZsOyD'></tfoot><dl id='ZsOyD'><fieldset id='ZsOyD'></fieldset></dl></div>

    <bdo id='ZsOyD'></bdo><ul id='ZsOyD'></ul>
    1. <small id='ZsOyD'></small><noframes id='ZsOyD'>

      1. <tfoot id='ZsOyD'></tfoot>
        <legend id='ZsOyD'><style id='ZsOyD'><dir id='ZsOyD'><q id='ZsOyD'></q></dir></style></legend>
      2. android SQLite 中的更新功能不起作用

        Update Function in android SQLite is not working(android SQLite 中的更新功能不起作用)
          <tfoot id='H8pVO'></tfoot>

          <small id='H8pVO'></small><noframes id='H8pVO'>

            <tbody id='H8pVO'></tbody>

              <legend id='H8pVO'><style id='H8pVO'><dir id='H8pVO'><q id='H8pVO'></q></dir></style></legend>
              <i id='H8pVO'><tr id='H8pVO'><dt id='H8pVO'><q id='H8pVO'><span id='H8pVO'><b id='H8pVO'><form id='H8pVO'><ins id='H8pVO'></ins><ul id='H8pVO'></ul><sub id='H8pVO'></sub></form><legend id='H8pVO'></legend><bdo id='H8pVO'><pre id='H8pVO'><center id='H8pVO'></center></pre></bdo></b><th id='H8pVO'></th></span></q></dt></tr></i><div id='H8pVO'><tfoot id='H8pVO'></tfoot><dl id='H8pVO'><fieldset id='H8pVO'></fieldset></dl></div>
                  <bdo id='H8pVO'></bdo><ul id='H8pVO'></ul>
                  本文介绍了android SQLite 中的更新功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的应用程序中,我需要向 SQLite 数据库添加和编辑数据.当我更新数据功能应用程序时不会给出任何错误,但我的数据库不会更新.这是我的更新功能.我在网上搜索了两天,但无法做到这一点.请帮帮我.

                  In my application I need to add and edit data to the SQLite database. When I do update data function app do not give any errors but my database wont update. Here is my Update function. I search in the web for two days but couldn't make this. Please help me.

                  public long updateEvent(String id, String title, String description, String reminder, String alarm, Date date) {
                  
                      try {
                          int rowid = Integer.parseInt(id);
                          Log.i("com.eventmanager", "insert Event");
                           formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                           String datestring = formatter.format(date);
                  
                          ContentValues cv = new ContentValues();
                          cv.put(KEY_TITLE, title);
                          cv.put(KEY_DESCRIPTION, description);
                          cv.put(KEY_REMINDER, reminder);
                          cv.put(KEY_ALARM, alarm);
                          cv.put(KEY_DATE, datestring);
                          myDB.beginTransaction();
                  
                          Log.i("com.eventmanager","SQL UPDATE ");
                  
                          myDB.update(DATABASE_TABLE, cv, KEY_ROWID + "=" + rowid, null);
                          myDB.setTransactionSuccessful();
                  
                          myDB.endTransaction();
                  
                      } catch (Exception e) {
                          e.printStackTrace();
                      }
                      return 1;
                  }
                  

                  提前致谢!!

                  推荐答案

                  可能是更新语句有问题,试试:

                  There may be a problem in the update statement, Try:

                   long i = myDB.update(DATABASE_TABLE, cv, KEY_ROWID + "=?", new String[]{rowid});
                  
                   if(i>0)
                       return 1;  // 1 for successful
                   else
                       return 0;  // 0 for unsuccessful
                  

                  是的,通过 public int update (String table, ContentValues values, String whereClause, String[] whereArgs) 函数.

                  这篇关于android SQLite 中的更新功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Cannot solve SonarQube error quot;Make this line start at column 3quot;(无法解决 SonarQube 错误“使此行从第 3 列开始)
                  SonarQube for multi module project for Android(适用于 Android 的多模块项目的 SonarQube)
                  How to integrate sonarqube in android studio?(如何在 android studio 中集成 sonarqube?)
                  Android What is the easist way Upgrade Database for existing DB(Android 为现有数据库升级数据库的简单方法是什么)
                  Updating SQLite database android(更新 SQLite 数据库 android)
                  Android: onUpgrade not calling at database upgrade(Android:onUpgrade 不在数据库升级时调用)

                      <legend id='073P3'><style id='073P3'><dir id='073P3'><q id='073P3'></q></dir></style></legend>
                        <tbody id='073P3'></tbody>
                      <tfoot id='073P3'></tfoot>
                        <bdo id='073P3'></bdo><ul id='073P3'></ul>
                        <i id='073P3'><tr id='073P3'><dt id='073P3'><q id='073P3'><span id='073P3'><b id='073P3'><form id='073P3'><ins id='073P3'></ins><ul id='073P3'></ul><sub id='073P3'></sub></form><legend id='073P3'></legend><bdo id='073P3'><pre id='073P3'><center id='073P3'></center></pre></bdo></b><th id='073P3'></th></span></q></dt></tr></i><div id='073P3'><tfoot id='073P3'></tfoot><dl id='073P3'><fieldset id='073P3'></fieldset></dl></div>

                            <small id='073P3'></small><noframes id='073P3'>