android sqlite - How to Add table in SQliteDatabase -
I want to add a table to the database and add a column and save the information and click it on the second button. To do this, if the table already exists, it is the only code I use, but it will insert information only after giving an error.
button insert_info = (Button) searching for Vivibiaiaidi (Arkdkbtn 1); insert_info.setOnClickListener (New OnClickListener () {@Override public void onClick (View v) {// TODO Auto-generated method stub SQLiteDatabase db; try {final EditText txt_field1 = (EditText) findViewById (R.id.editText1); string Per_Name = txt_field1.getText () putting toString () ;. db = openOrCreateDatabase ( "sez.db", SQLiteDatabase.CREATE_IF_NECESSARY, null); string Query_createTable = "Create table sezInformation (name VARCHAR (100))", string Query_insert = " SezInformation (name) values ( "+ Per_Name +") ", db.execSQL (Query_insert);} catch (exception e) {Toast.makeText (WelomePerson.this," error "+ e.toString (), Toast.LENGTH_LONG) Show ();}}}); Even when I enter the values I Khan or Aditekt Click on fields and buttons There is no such column: When Khan joins the information (name) Value (Khan) Please also tell me how to recover the same saved data in TextView Please. Use
or if the table instead of the CREATE TABLE does not make Are . Also, make sure to use 2 different execSQL () commands (to create and insert a table), or it will not work, because you can not execute multiple commands Once .
Comments
Post a Comment