SHARE
TWEET

Untitled

a guest Nov 19th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class DatabaseHelper (context : Context)
  2.     : SQLiteOpenHelper (context , "sekolah.db"
  3.     , null ,  1){
  4.  
  5.     override fun onCreate(db: SQLiteDatabase?) {
  6.  
  7.         val sql = "CREATE TABLE siswa ( " +
  8.                 "$COL_ID INTEGER PRIMARY KEY AUTOINCREMENT, " +
  9.                 "namad TEXT, " +
  10.                 "$COL_NAMAB TEXT, " +
  11.                 "$COL_NOHP TEXT, " +
  12.                 "$COL_JENJANG TEXT, " +
  13.                 "$COL_GENDER TEXT, " +
  14.                 "$COL_ALAMAT TEXT, " +
  15.                 "$COL_HOBI TEXT)"
  16.  
  17.         db?.execSQL(sql)
  18.  
  19.     }
  20.  
  21.     override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
  22.  
  23.  
  24.     }
  25.  
  26.     companion object{
  27.         val COL_ID = "id"
  28.         val COL_NAMAD = "namad"
  29.         val COL_NAMAB = "namab"
  30.         val COL_NOHP = "nohp"
  31.         val COL_GENDER= "jk"
  32.         val COL_HOBI = "hobi"
  33.         val COL_JENJANG = "jenjang"
  34.         val COL_ALAMAT = "alamat"
  35.  
  36.     }
  37.  
  38.  
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top