Wednesday, 8 April 2015

Insert data into a table in android using sqlite



Here i am going to explain how to insert value in database using SQLite  in android.Before that, you must Know about SQLite 



SQLite 
   
            SQLite is an in-process library that implements a self-contained, serverless, zero- configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private

public void insertEntry() 

{
 
    try 
        {
SQLiteDatabase db = this.getWritableDatabase();

              ContentValues values = new ContentValues();

values.put("Messsage", msg);
                     values.put("Name", SenderName);
                     values.put("GroupName", Groupname);

db.insert("TableName", null, Values);


        catch (Exception e) 
{

}

}