2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

from docs: execSQL(String sql, Object[] bindArgs) Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.
@Selvin I know. Its a custom function I wrote for the ease of use. That's why I've given link to Vogella's tutorial which uses the standard methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.