I need to build some nested conditions (AND (this OR that)), but I don’t think I’m understanding how the filterParams argument works.
I keep getting errors similar to:
System.Data.SqlClient.SqlException: ‘Must declare the scalar variable “@FirstName”.’
with this:
sql = sql.And("(FirstName like @FirstName OR LastName like @LastName", new {FirstName = firstName, LastName = lastName});
I’ve also tried
sql = sql.And("(FirstName like @FirstName OR LastName like @LastName", FirstName, LastName);
Either way it seems the params are numbered (not named) while debugging (@0, @1, @2, etc…). I guess I’m using it incorrectly. Is what I’m trying to do not possible?