update table by table name, column name and column value - Android Database

Android examples for Database:Table Update

Description

update table by table name, column name and column value

Demo Code

/**/*  ww w .ja va2  s  .  com*/
 * Copyright (c) 2014, German Neuroinformatics Node (G-Node)
 * Copyright (c) 2014, Shumail Mohy-ud-Din <shumailmohyuddin@gmail.com>
 * Copyright (c) 2013, Yasir Adnan <adnan.ayon@gmail.com> 
 * License: BSD-3 (See LICENSE)
 */
//package com.java2s;
import android.content.ContentValues;

import android.database.sqlite.SQLiteDatabase;

import android.util.Log;

public class Main {
    public static SQLiteDatabase database;
    public static final String TABLE_ABSTRACT_NOTES = "ABSTRACT_NOTES";

    public static void updateNoteABSTRACT_NOTES(String note_id,
            String noteTitle, String NoteText) {

        ContentValues values = new ContentValues();

        values.put("NOTE_TITLE", noteTitle);

        values.put("NOTE_TEXT", NoteText);

        long rows_affected = database.update(TABLE_ABSTRACT_NOTES, values,
                "NOTE_ID = ?", new String[] { note_id });
    }
}

Related Tutorials