我是安卓新手。我正在尝试使用 SQLite 在我的第一个应用程序中更新表。但是当我从 SQLite 管理器查看表格时,我发现表格没有更新。我找不到问题出在哪里?
public void EntryHesapla(int yilsql, String aysql,int digerTaksitlersql,
int digersql,int maasSelosql,int maasHilalsql,int digerGelirlersql,
int toplamHarcamasql,int toplamGelirsql,int eldeKalansql) {
ContentValues cv = new ContentValues();
cv.put(C_YIL, yilsql);
cv.put(C_AY, aysql);
cv.put(C_DIGERTAKSITLER, digerTaksitlersql);
cv.put(C_DIGER, digersql);
cv.put(C_MAASSELO, maasSelosql);
cv.put(C_MAASHILAL, maasHilalsql);
cv.put(C_DIGERGELIRLER, digerGelirlersql);
cv.put(C_TOPLAMHARCAMA, toplamHarcamasql);
cv.put(C_TOPLAMGELIR, toplamGelirsql);
cv.put(C_ELDEKALAN, eldeKalansql);
String[] selectionArgs=new String[]{yilsql+"", aysql};
String entryHesaplaSQL="SELECT c_id FROM harcamalar WHERE "+C_YIL+"= ? AND "+C_AY+"= ?";
Cursor cursor=ourDatabase.rawQuery(entryHesaplaSQL, selectionArgs);
cursor.moveToFirst();
cursor.moveToPosition(cursor.getCount() - 1);
int index=cursor.getInt(cursor.getColumnIndex(C_ID));
if(index>=0)
ourDatabase.update(DB_TABLE, cv, C_ID+"="+index, null);
else ourDatabase.insert(DB_TABLE, null, cv);
}