i ahve database in which i hava login information iwa nted to check weather the persons login information is correct or wrong.
i m very new to asp. so any body help how i have to proceed

<%dim user,pass
user=request.form("usercode")
pass=request.form("pass")
response.write(user)
response.write(pass)
' Open database
Dim Conn, RS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user

; pwd=pass option=3;"
Set RS = Conn.Execute("SELECT * From userss where username='user' and password='pass'")
if RS="user" then
response.write("login")
end if
%>
i m trying some how like this but getting error. i think i dont know how to check the login information with database .pls help

here is the code that can help you in designing the login page for the users. It is well commented so I think you will have no problem in understanding that.

<%
Dim adoConn   'Database Connection Variable
Dim rsCheckUser   'Database Recordset Variable
Dim strSQL   'Database query sring
Dim strUserName  'Holds the user name
Dim strPassword  'Holds the Password
 
'Initalise the strUserName variable
strUserName = Request.Form("UserName")
strPassword = Request.Form("Passowrd")
 
'Create a connection odject
Set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user 
'Create a recordset object
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")

'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT UserName, Password FROM tblUsers WHERE UserName ='" & strUserName & "'"

'Query the database
rsCheckUser.Open strSQL, adoConn

'If the recordset finds a record for the username entered then read in the password for the user
If NOT rsCheckUser.EOF Then
 
 'Read in the password for the user from the database
 If (strPassword) = rsCheckUser("Password") Then
  
  'If the password is correct then set the session variable to True
  Session("LoggedIn") = True
  
  'Close Objects before redirecting
  Set adoCon = Nothing
  Set strCon = Nothing
  Set rsCheckUser = Nothing
  
  'Redirect to the authorised user page and send the users name
  Response.Redirect "loggedin.asp" 
End If
End If
  
'Close Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
 
'If the script is still running then the user must not be authorised
Session("LoggedIn") = False
'Redirect to the unautorised user page
Response.Redirect "login.asp"
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.