i have 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. pls help

Recommended Answers

All 6 Replies

what error message exactle are you getting? Also, your code is classic asp but you are posting in the asp .net forum.

Change your connection string to this format (with your application specific details of course)

oConn.Open "Provider=MySQLProv;" & _
           "Data Source=mySQLDB;" & _
           "User Id=myUsername;" & _
           "Password=myPassword"

Change your connection string to this format (with your application specific details of course)

oConn.Open "Provider=MySQLProv;" & _
           "Data Source=mySQLDB;" & _
           "User Id=myUsername;" & _
           "Password=myPassword"

but i dont have any problem with my database connection.
i think problem with the login information check with database

<%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.EOF then
response.write("not found")
else
response.write("u have loged in")
end if
' display results
'While Not RS.EOF
'Response.Write RS.Fields("userco") & "<br>"
'RS.MoveNext
'Wend
' closing connection
RS.Close
Conn.Close
Set RS = Nothing
Set Conn = Nothing%>


i m using thsi code if the login information is correct still it give sthe logininformation not found

Change this select statment as : ("SELECT * From userss where username=" + user + "and password=" + pass)

Could be another thought. Remember, always test the SELECT statement as is outside the application to see if it returns what you are actually sending in.

thank u very much

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.