able to connect to database but doesnt verify agai

Results 1 to 2 of 2

Thread: able to connect to database but doesnt verify agai

  1. #1
    Join Date
    Dec 1969

    Default able to connect to database but doesnt verify agai

    I am able to connect to database but it doesnt verify the login and password I provide against my database as per my asp page containing fields for login and password...<BR>I have made System DSN to my SQL Server Database...<BR>I have made security access in SQL Server 2000 for my database...<BR>have given login id and password for that particular database<BR>In System DSN I have given SQL Sever authentication<BR>and provided login id and password for the checkbox of default <BR>settings for SQL Server... Given default databse as that particular databse to which m connecting and tests completed successfully...which means that i m able to connect to SQL Server thru ODBC..<BR><BR>Now comes the ASP code thru which i want to connect to my database:<BR>&#060;%<BR><BR>&#039;create an ADO connection object <BR>Set conn= Server.CreateObject("ADODB.Connection") <BR><BR> "DSN=database-name;" & _ <BR>"UID=user id that i created for my database and provided in System DSN(same);PASSWORD=corresponding password;" <BR><BR>set rs = server.createobject ("ADODB.recordset") <BR><BR>&#039;Open record with entered username<BR>rs.Open "SELECT * FROM s_Info where s_Loginid=&#039;"& Username &"&#039;", conn, 1 <BR><BR><BR><BR>&#039;If there is no record with the entered username, close connection<BR>&#039;and go back to login with QueryString<BR>If rs.recordcount = 0 then<BR>rs.close<BR>conn.close<BR>set rs=nothing<BR>set conn=nothing<BR>Response.Redirect(" p?login=passfailed")<BR>end if<BR><BR>&#039;If entered password is right, close connection and open mainpage<BR>if rs("s_Pass") = Password then<BR>Session("name") = rs("s_Fname")<BR>rs.Close<BR>conn.Close<BR>set rs=nothing<BR>set conn=nothing<BR>Response.Redirect("studenthome.asp ")<BR>&#039;If entered password is wrong, close connection <BR>&#039;and return to login with QueryString<BR>else<BR>rs.Close<BR>conn.Close<BR>s et rs=nothing<BR>set conn=nothing<BR>Response.Redirect(" p?login=passfailed")<BR>end if <BR>%&#062;<BR><BR>When i insert login and password according to my databse records <BR>it goes to Response.Redirect("studentlogin.asp?login=passfail ed") even though my login id and password are correct ... I dun understand what the problem is.. I can come up with solutions :<BR>1&#062; something has to be related to IIS -some settings <BR>2&#062; or SQL Server 2000 registration properties ...<BR>

  2. #2
    Join Date
    Dec 1969

    Default query both parameters

    query both login and password...<BR><BR>if not rs.EOF then<BR> &#039;login/password found<BR>else<BR> &#039;login/ password incorrect<BR>end if

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts