The Dapper documentation states you can send off multiple queries at once and iterate over the results using the QueryMultiple method like so:
var sql = @"
select * from foo where id = @paramname
select * from bar where id = @paramname";
conn.QueryMultiple(sql, new {paramname = paramval});
It would appear using sqlite like this doesn't work, throwing up invalid sql near "select". How do I use querymultiple with sqlite?
After some playing, I noted that you appear to need to use a semicolon between the commands
so the above code corrected becomes:
var sql = @"
select * from foo where id = @paramname;
select * from bar where id = @paramname";
conn.QueryMultiple(sql, new {paramname = paramval});
No, don't use the code like this, use the return of a QueryMultiple
as a using
statement, so it can be automatically disposed of.