kavya
kavya

Reputation: 358

Insert different datas to different table from a single insert query in sqlite in android

I wanted to insert different values to, two different sqlite tables from a single insert query.Can any one help me out...........

Upvotes: 2

Views: 127

Answers (1)

Jaya Mayu
Jaya Mayu

Reputation: 17247

Why can't you do it in two lines?? Programme will execute one after another.

You can do something as below

dbHelper = new RdmsDbAdapter(SDCardVideoActivity.this);
dbHelper.open();
dbHelper.executeSQL("CREATE TABLE IF NOT EXISTS videos(urls text)");
dbHelper.executeSQL("insert into videos values ('"+outputfilepathVideo+"', '"+IncidentFormActivity.incident_id+"')");
dbHelper.executeSQL("CREATE TABLE IF NOT EXISTS audios(urls text)");
dbHelper.executeSQL("insert into audios values ('"+outputfilepathAudio+"', '"+IncidentFormActivity.incident_id+"')");
dbHelper.close();

Learn on how to handle sqlite with Android here.

Upvotes: 1

Related Questions