Reputation: 314
I was just trying out Dapper for the very first time.
When I try to execute a query like the following, I encounter an ArgumentException "invalid type owner for DynamicMethod". Unlinke in this question, inserts work just fine when using Execute().
var parameters = new[] { new { accountName = name, accountPassword = password } };
var accounts = connection.Query<Account>(@"SELECT * FROM " + this.TableName + " WHERE name = @accountName AND password = @accountPassword", parameters);
I am building against .NET 4.5 on Win7.
Can anybody tell what I am doing wrong?
Upvotes: 7
Views: 4502
Reputation: 46859
Your parameters should just be:
var parameters = new { accountName = name, accountPassword = password };
Not sure what you are trying to do with the new[] new
Upvotes: 10