goutham

goutham

  • NA
  • 8
  • 14.8k

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

Jul 25 2012 2:33 AM

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)