mardi 2 février 2016

Android SQL error table Wycieczki has no column named Sredniapredkosc [duplicate]

This question already has an answer here:

Hi i have problem with Android database. I made from start database
Code is same for onUpgrade

@Override
public void onCreate(SQLiteDatabase db)
{
    db.execSQL
            (
                    "create table Wycieczki(" +
                            "nr integer primary key autoincrement, " +
                            "Nazwa text, " +
                            "Cel text, " +
                            "Odleglosc text, " +
                            "Sredniapredkosc text, " +
                            "Srodeklokomocji text); " +
                            ""
            );
}

When I am using method doda_wycieczke I am getting an error

E/SQLiteLog: (1) table Wycieczki has no column named Sredniapredkosc

Code

    public void dodaj_wycieczke(String nazwa,String cel,String odleglosc,String sredniapredkosc ,String srodeklokomocji)
{
    SQLiteDatabase db = getWritableDatabase();
    ContentValues wartosci= new ContentValues();
    wartosci.put("Nazwa",nazwa);
    wartosci.put("Cel",cel);
    wartosci.put("Odleglosc",odleglosc);
    wartosci.put("Sredniapredkosc",sredniapredkosc);
    wartosci.put("Srodeklokomocji",srodeklokomocji);
    db.insert("Wycieczki", null, wartosci);
    Log.e("Dodawanie do bazy", "Dodawanie...");
}

using metod

        mojabaza = new Baza3(context);
    sqLiteDatabase = mojabaza.getWritableDatabase();
    mojabaza.dodaj_wycieczke(tablica[0],tablica[1],tablica[2],tablica[3],tablica[4]);
    mojabaza.close();

How can I resolve this ?

Aucun commentaire:

Enregistrer un commentaire