I want to add sqlite in my application i have created DB and table but the SELECT and INSERT query is not working i Don't know why? Here i have added my code:
static Cursor c;
SQLiteDatabase db;
db=openOrCreateDatabase("weatherregisterDB", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS weatherRegister(id INTEGER PRIMARY KEY AUTOINCREMENT,name VARCHAR,username VARCHAR,password VARCHAR,confirmpassword VARCHAR);");
register.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
db.execSQL("INSERT INTO weatherRegister(id,name,username,password,confirmpassword) VALUES('',sample,sample,sample,sample);");
c=db.rawQuery("SELECT username FROM weatherRegister WHERE username=sample", null);
My Error is:
android.database.sqlite.SQLiteException: no such column: sample (code 1): , while compiling: INSERT INTO weatherRegister(id,name,username,password,confirmpassword) VALUES('',sample,sample,sample,sample);
Aucun commentaire:
Enregistrer un commentaire