Wednesday, February 1, 2012

How to use Update,delete query in SQLite db?



DBAdapter databaseManager=DBAdapter.getSharedObject(SaleCreatePlannerActivity.this);
SQLiteDatabase sqdb = databaseManager.getWritableDatabase();

//Below is the example for Update
sqdb.execSQL("UPDATE CreateSalesPlanner SET Week1='"+week1+"'  WHERE ProductId='"+productId+"' AND StockId='"+mstockId+"' AND MonthId='"+mmonthId+"' " );

//Below is the example for delete

sqdb.execSQL("DROP TABLE IF EXISTS CreateSalesMonthTable");

//Below is the example for creating table
 sqdb.execSQL("CREATE TABLE TableName(MonthId TEXT NULL,MonthName TEXT NULL,ePeriod TEXT NULL)");

No comments:

Post a Comment