Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package com.example.pc.nitiphon_restaurant;
  2.  
  3. /**
  4. * Created by Pc on 26/10/2559.
  5. */
  6. import android.content.ContentValues;
  7. import android.content.Context;
  8. import android.database.sqlite.SQLiteDatabase;
  9.  
  10. /**
  11. * Created by Admin on 26-Oct-16.
  12. */
  13. public class MySQLite {
  14.  
  15. private MySQLiteOpenHelper mySQLiteOpenHelper;
  16. private SQLiteDatabase sqLiteDatabase;
  17.  
  18. public static final String user_table = "userTABLE";
  19. public static final String column_id = "_id";
  20. public static final String column_user = "User";
  21. public static final String column_password = "Password";
  22. public static final String column_name = "Name";
  23.  
  24. public MySQLite(Context context) {
  25. mySQLiteOpenHelper = new MySQLiteOpenHelper(context);
  26. sqLiteDatabase = mySQLiteOpenHelper.getWritableDatabase();
  27.  
  28.  
  29. }//Constructor
  30.  
  31. public long addNewUser(String strUser,
  32. String strPassword,
  33. String strName) {
  34. ContentValues contentValues = new ContentValues();
  35. contentValues.put(column_user, strUser);
  36. contentValues.put(column_password, strPassword);
  37. contentValues.put(column_name, strName);
  38.  
  39. return sqLiteDatabase.insert(user_table, null, contentValues);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement