Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. DatabaseHelper mDbHelper = new DatabaseHelper(mCtx);
  2. SQLiteDatabase mDb = mDbHelper.getWritableDatabase();
  3. SQLiteDatabase mDc = mDbHelper.getReadableDatabase();
  4.  
  5. //////
  6. Cursor mCursorZ = mDc.query(SQLITE_TABLE, new String[] { KEY_ROWID,
  7. PRODUCT_NAME, categoryName, price, categoryNum, qty }, null,
  8. null, null, null, null);
  9.  
  10.  
  11. Cursor mCursor = mDb.rawQuery("SELECT * FROM " + SQLITE_TABLE
  12. + " WHERE " + recordName + " ='" + ValueCheck + "'", null);
  13.  
  14. if (mCursor != null && mCursor.moveToFirst()) {
  15.  
  16. Toast.makeText(mCtx, "Available", 3000).show();
  17.  
  18.  
  19. String addQuery = "UPDATE " + SQLITE_TABLE +
  20. " SET "+ qty+"="+ qty +" + " + changedQTY +" ," +
  21. price + " = " + "(" + qty + " + " +changedQTY +")" +" *" +regPrice +
  22.  
  23. " WHERE " +PRODUCT_NAME + "='" + changedPNAme + "';";
  24.  
  25. mDb.execSQL(addQuery);
  26. mCursorZ.requery();
  27.  
  28.  
  29. } else {
  30. Toast.makeText(mCtx, "Not Available", 3000).show();
  31.  
  32. createCountry(changedPNAme, theCategory, changedPrice, theCatN, changedQTY);
  33. mCursorZ.requery();
  34.  
  35.  
  36.  
  37. /* record not exist */
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement