The following code when compiling gives the error message below:
'System.Data.SqlClient.SqlConnection' does not contain a definition for 'Query' and no extension method 'Query' accepting a first argument of type 'System.Data.SqlClient.SqlConnection' could be found (are you missing a using directive or an assembly reference?)
I have added Dapper using the nuget packager.
Any ideas? Thanks,
CODE:
using (SqlConnection sqlConnection = new SqlConnection(Connectionstring)) { sqlConnection.Open(); Member customer = sqlConnection.Query<Member>("SELECT * FROM member"); return customer; }
You need to place a using statement in your .cs file to make the Dapper extension methods available.
using ...; using Dapper; using ...;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With