you can use sql statement like below
select count(*) Login where Name =@Name and Pass =@Pass
then you will get 0 or 1 for given inputs, if you get 1 means both user name and password as correct and record exist, that means user login success. otherwise login failed.
you need to learn few best practices, don't store plan passwords, check
Password Storage: How to do it.[
^]
in above sql statement I have
use parameters[
^]. they are safe and you can avoid sql injection attacks
above sql statement give you one value, so you can use
commad.ExcuteScaler method[
^] retrieve the value