Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Sqlite how to use one table out of the two created?
    primarykey
    data
    text
    <p>I am on Android and this question is of Sqlite :</p> <p>I have a table (<code>USERLOGIN</code>) which holds the user's credentials (username and password) in it. I have another table (<code>$USER$_PROJS</code>) which holds information of projects for a particular user. Users can create and add projects in there.</p> <p>[ <code>$USER$</code> will be a variable which comes from the column <code>username</code> in <code>USERLOGIN</code> table. So its basically a dynamic table creation. ]</p> <p>Both of these tables are in the same database USER.db. I have only one <code>LoginDatabseAdapter</code> class and <code>DatabseHelper</code> class which manages both of these.</p> <p>Now initially when user logs-in, the database is behaving properly. But when inside the user profile when a user tries to create/add project its not inserting the values into <code>$USER$_PROJS</code> table.</p> <p>I think i need to use the <code>USE TABLE</code> (once the user successfully logs-in his profile) like statement but its giving an error when i try to use it.</p> <p>I have searched almost all the resources on net but was unable to find the solution !!<br> Any help would be appreciated !!</p> <p>CODE RESPONSIBLE FOR CREATING TABLE :</p> <pre><code>public void createprojtable(String u){ db.execSQL( "create table if not exists "+u+"_PROJS(ID integer primary key autoincrement, PROJ_NAME text,DATE text); "); } public void insertProjEntry(String u,String projName, String projdate) { //db.execSQL("use table "+u+"_PROJS;"); ContentValues newValues = new ContentValues(); newValues.put("PROJ", projName); newValues.put("DATE", projdate); db.insert(u+"_PROJS", null, newValues); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload