SQLiteLog: no such table
<p>About my app: Saves training performance - one database with many tables(one table is log of workout). Date is name of the table( e.g. d2016_08_09 ). When user presses "save button", app sets name of table.</p>

<pre><code>public static final String DB_NAME ="db_workout";//name of base
public static  String DB_TABLE ="dateOfWorkout";//name of table
public static final int DB_VER =1;

public static void setDbTable(String dbTable) {
    DB_TABLE = dbTable;
}

public Base(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, String db_table_name) {
    super(context, DB_NAME, null, DB_VER);
    setDbTable(db_table_name);
    System.out.println(DB_TABLE);
}


@Override


public void onCreate(SQLiteDatabase db){
    db.execSQL(
            "create table IF NOT EXISTS "+ DB_TABLE +"("
            + "nr integer primary key autoincrement,"
            + "name text,"
            + "s1 integer,"
            + "s2 integer,"
            + "s3 integer,"
            + "s4 integer,"
            + "s5 integer,"
            + "weight integer);"
            +"");

}

public void addWorkoutPlan(String i, int q, int w, int e, int r, int t, int wt) {
    SQLiteDatabase db = getWritableDatabase();
    ContentValues wartosci = new ContentValues();

    wartosci.put("name", i);
    wartosci.put("s1", q);
    wartosci.put("s2", w);
    wartosci.put("s3", e);
    wartosci.put("s4", r);
    wartosci.put("s5",t);
    wartosci.put("weight",wt);



    db.insertOrThrow(DB_TABLE, null, wartosci);
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    //uzupelnic

}
</code></pre>

<p>and the class where I use add date to base</p>

<pre><code>sNameTable = "d"+sNameTable;
    db= new Base(this,null,null,0,sNameTable);

    bAddDate = (Button) findViewById(R.id.bAddDate);



    bAddDate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            setValues(); // setting values 





                for (int i = 0; i &lt; 1; i++) {

                    db.addWorkoutPlan(
                            tName[0][i].toString(),//nazwa cwiczenia
                            Integer.parseInt(tSeries[0][i].getText().toString()),//1. seria
                            Integer.parseInt(tSeries[1][i].getText().toString()),
                            Integer.parseInt(tSeries[2][i].getText().toString()),
                            Integer.parseInt(tSeries[3][i].getText().toString()),
                            Integer.parseInt(tSeries[4][i].getText().toString()),
                            Integer.parseInt(tWeight[0][i].getText().toString())

                    );
                }

                Context context = getApplicationContext();
                CharSequence text = "Trening dodany";
                int duration = Toast.LENGTH_SHORT;
                Toast toast = Toast.makeText(context, text, duration);
                toast.show();


        }
    });
}
</code></pre>

<p>when I press button to add date, app crashes and AndroidStudio get this log:</p>

<blockquote>
  <p>23190-23190/com.example.konra_000.workoutplan E/SQLiteLog: (1) no such table: d2016_08_09</p>
  
  <p>23190-23190/com.example.konra_000.workoutplan
  E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                     Process: com.example.konra_000.workoutplan, PID: 23190
                                                                                     android.database.sqlite.SQLiteException: no such table: d2016_08_09
  (code 1): , while compiling: INSERT INTO
  d2016_08_09(name,s3,weight,s2,s1,s5,s4) VALUES (?,?,?,?,?,?,?)</p>
</blockquote>