Reputation: 1986
I am developing an android application where i need to enter multiple rows in database at a one go, i have 18 rows and 4 columns in my user interface which are edit texts , is it possible to enter all data i data base with one button click , how can i do that ? Here is my code to generate one row
public void addRow(String rowStringOne, String rowStringTwo)
{
// this is a key value pair holder used by android's SQLite functions
ContentValues values = new ContentValues();
values.put(TABLE_ROW_ONE, rowStringOne);
values.put(TABLE_ROW_TWO, rowStringTwo);
// ask the database object to insert the new data
try{db.insert(TABLE_NAME, null, values);}
catch(Exception e)
{
Log.e("DB ERROR", e.toString());
e.printStackTrace();
}
}
Upvotes: 1
Views: 2236
Reputation: 8142
It depends from where you get the data. You have two possible scenarios.
Upvotes: 1