Answers for "dapper query list of parameters"

C#
0

dapper query list of parameters

var sql = "SELECT * FROM Invoice WHERE Kind IN @Kind;";

using (var connection = My.ConnectionFactory())
{
	connection.Open();

	var invoices = connection.Query<Invoice>(sql, new {Kind = new[] {InvoiceKind.StoreInvoice, InvoiceKind.WebInvoice}}).ToList();
}
Posted by: Guest on December-19-2020
0

dapper query list of parameters

List<string> names = new List<string> { "Bob", "Fred", "Jack" };
string query = "select * from people where Name in @names";
var stuff = connection.Query<ExtractionRecord>(query, new {names});
Posted by: Guest on December-19-2020

C# Answers by Framework

Browse Popular Code Answers by Language