1
Answer

how to validate username and password from database using Linq in c# asp.net

goutham

goutham

12y
4k
1

i already make a " .dbml  " file and also Stored Procedure name '' sp_LoginValidation''
 i am used like this but it shows some error...........

LoginValidationDataContext check = new LoginValidationDataContext();

        var result = from p in check.sp_LoginValidation ()
                     where p.UserName == LoginUser.UserName && p.Password = LoginUser.Password
                     select p.FirstOrDefault();

        if (result != false)
        {
            Response.Redirect("UserRegistration.aspx");
        }
        else
        {
           Responce.write("  <script> alert ('invalid  credentials')<script/>");
        }

        }
Answers (1)