login check

Reply

Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

login check

 
0
  #1
Oct 24th, 2005
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

  1. <%dim user,pass
  2. user=request.form("usercode")
  3. pass=request.form("pass")
  4. response.write(user)
  5. response.write(pass)
  6. ' Open database
  7. Dim Conn, RS
  8. Set Conn = Server.CreateObject("ADODB.Connection")
  9. Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user
  10.  
  11. ; pwd=pass option=3;"
  12. Set RS = Conn.Execute("SELECT * From userss where username='user' and password='pass'")
  13. if RS="user" then
  14. response.write("login")
  15. end if
  16. %>
i m trying some how like this but getting error. pls help
Last edited by Paladine; Oct 25th, 2005 at 12:28 pm. Reason: Adding Code blocks
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: login check

 
0
  #2
Oct 24th, 2005
what error message exactle are you getting? Also, your code is classic asp but you are posting in the asp .net forum.
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: login check

 
0
  #3
Oct 25th, 2005
Change your connection string to this format (with your application specific details of course)

  1. oConn.Open "Provider=MySQLProv;" & _
  2. "Data Source=mySQLDB;" & _
  3. "User Id=myUsername;" & _
  4. "Password=myPassword"
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: login check

 
0
  #4
Oct 25th, 2005
Originally Posted by Paladine
Change your connection string to this format (with your application specific details of course)

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

but i dont have any problem with my database connection.
i think problem with the login information check with database
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: login check

 
0
  #5
Oct 25th, 2005
<%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
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: login check

 
0
  #6
Oct 25th, 2005
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.
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: login check

 
0
  #7
Oct 25th, 2005
thank u very much
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC