Android: Unable To Insert Data Into Sqlite Using Dbhelper And Contract Class
public class Main2Activity extends AppCompatActivity { private EditText editText1, editText2, editText3, editText4; private Button button; @Override protected void
Solution 1:
Replace your CREATE_TABLE query with:
StringCREATE_TABLE="CREATE TABLE " + Entry.TABLE_NAME + " ("
+ Entry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ Entry.C_UNAME + " TEXT, "
+ Entry.C_PASS + " TEXT, "
+ Entry.C_CPASS + " TEXT, "
+ Entry.C_PNO + " TEXT" + ")";
You can't have a TEXT
type have an AUTOINCREMENT
property as you currently have it on your _ID
field. You need to change it to be an INTEGER
so it can be used as PRIMARY KEY
and then have it AUTOINCREMENT
Post a Comment for "Android: Unable To Insert Data Into Sqlite Using Dbhelper And Contract Class"