Combine database prepared statements?

Hi,
As an example - I have the following code below, which performs an update query on a database.

My question is - is it possible to combine an additional UPDATE query with the code below somehow - or must I completely execute this query first, and then start all over again with another query?

I am simply trying to find the most efficient way to perform 2 separate queries on a database at the same time.
Hope my question made sense.

Dim ps As SQLitePreparedStatement = SongsDB.Prepare("UPDATE Songs SET Song=? WHERE Lyrics=?") ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT) ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT) ps.Bind(0, SongWindow.NameField.text) ps.Bind(1, LyricsSel) ps.SQLExecute

An update isn’t a query - select is a query

You can only update ONE TABLE per update statement
So unless its updating the same table using the same where clause - no

Sorry - I meant statement (not query). It’s a quarter past midnight here and I have been coding for 15 hours straight - not surprised I have mixed my words :slight_smile:

So basically I need to execute my statement above, then perform all the relevant error checks - THEN start all over again with another prepared statement.

Thanks - I just thought maybe there was a more code efficient way of doing it.

Thanks Bruce :slight_smile:

You can reuse a prepared statement & bind types.

This part is re-usable.

Dim ps As SQLitePreparedStatement = SongsDB.Prepare("UPDATE Songs SET Song=? WHERE Lyrics=?") ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT) ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)

This part would change with each use.

ps.Bind(0, SongWindow.NameField.text) ps.Bind(1, LyricsSel) ps.SQLExecute

If that’s what you’re asking.