The following query
Connection.Query<User>("select * from User where Login=@login and Passwd=@passwd", new { login = _login, passwd=_passwd})
returns the following error
Must declare the scalar variable @login
The User model :
public class User
{
public int Id { get; set; }
public string Login { get; set; }
public string Passwd { get; set; }
}
UPDATE :
My problem was coming from the SQL connection
My connection string was
new OleDbConnection(@"Provider=sqloledb;Data Source=MYPC\SQLEXPRESS;Initial Catalog=MYDB;User Id=sa;Password=****;");
I've changed it to
new SqlConnection(@"Data Source=MYPC\SQLEXPRESS;Initial Catalog=MYDB;User Id=sa;Password=****;");
_login
have a value when you stop there at a breakpoint? – stuartd Jun 19 '18 at 16:10