0

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

3
Contributors
6
Replies
9
Views
11 Years
Discussion Span
Last Post by aarya
0

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

0

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"
0

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

0

<%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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.