samedi 9 janvier 2016

database error android sqlite

i am getting this error: .SQLiteException: no such table: Entry_table (code 1): , while compiling: INSERT INTO Entry_table(AMOUNT,CARET,BALANCE,AMOUNT_PAID) VALUES (?,?,?,?)

my code:
public class Entry extends AppCompatActivity {
    Button btnsbmt1;
    Spinner spiner2;
    EditText milkcaret,amount, amountp,bal;


    DatabaseHelper mydb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_entry);
        mydb=new DatabaseHelper(this);

        btnsbmt1=(Button)findViewById(R.id.btnsubmit2);
        spiner2=(Spinner)findViewById(R.id.spinner2);
        milkcaret=(EditText)findViewById(R.id.txt1_de);
        amount=(EditText)findViewById(R.id.txt2_de);
        amountp=(EditText)findViewById(R.id.txt3_de);
        bal=(EditText)findViewById(R.id.txt4_de);


        adddata2();

    }

    public void adddata2(){
        btnsbmt1.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        boolean inserted = mydb.insertdatat(milkcaret.getText().toString(),amount.getText().toString(),amountp.getText().toString(),bal.getText().toString());

                        if (inserted)
                            Toast.makeText(Entry.this, "data inserted", Toast.LENGTH_SHORT).show();
                        else {
                            Toast.makeText(Entry.this, "database error", Toast.LENGTH_SHORT).show();
                        }

                    }
                }
        );
    }
}

Aucun commentaire:

Enregistrer un commentaire