|
-
Apr 4th, 2003, 09:16 AM
#1
Thread Starter
Member
Check if data is correct. I have a Password problem.
Hi,
I have this program that users have to login. using a database.
the problem is i don't know how to make the program to see if the password matches the username or even if the username and password exist.
you know what i mean.........
can you please help me out with this. is there a simple sample code you can give me so i could play around with it.
thankyou very very much.
I hope you can help.
-
Apr 4th, 2003, 10:34 AM
#2
Frenzied Member
is the application created in VB or Asp or something else?
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 4th, 2003, 01:06 PM
#3
Thread Starter
Member
well its obvious that i am using
VISUAL BASIC .
do you no what to do?
-
Apr 4th, 2003, 01:29 PM
#4
Frenzied Member
mmm....k, what type of database are you using? Don't assume we know what you are using. i.e. vb, asp. Try to provide as much information as possible in your original post, that way we don't have to continue to ask questions.
People post questions hear relating to all kinds of apps (VB, C++, Java, ASP, PHP) as well as all kinds of databases (Access, MS SQL, PostgresSQL, Oracle.) So being clear about what programming or database you are using in the beginning will save time.
Last edited by Memnoch1207; Apr 4th, 2003 at 01:34 PM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 4th, 2003, 02:02 PM
#5
Thread Starter
Member
hi,
visual basic 6
microsoft access 2002 ( but i can convert to 97 database too )
please help.
thanks
-
Apr 4th, 2003, 02:50 PM
#6
Frenzied Member
Code:
'Connection to database
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\pathToDB\myDb.mdb;" & _
"User Id=yourUserid;" & _
"Password=yourPassword"
Set adoprimaryrs = New Recordset
'2 fields in database table username and password
adoprimaryrs.Open "SELECT * from tableName", conn, adOpenStatic, adLockOptimistic
'2 textboxes on the form txtUsername and txtPassword
If txtUsername.Text = Trim(adoprimaryrs.Fields("userName")) And txtPassword.Text = Trim(adoprimaryrs.Fields("password")) Then
LoginSucceeded = True
Me.Hide
FormMain.Show
Else
MsgBox "Invalid username/Password, try again!", , "Login"
txtUsername.SetFocus
SendKeys "{Home}+{End}"
End If
or
Code:
set adoPrimaryRs = "SELECT * FROM tableName WHERE Username = '" & txtUsername.Text & "'
if(adoPrimaryRs.RecordCount = 1) then
LoginSucceeded = True
Me.Hide
FormMain.Show
else
MsgBox "Invalid username/Password, try again!", , "Login"
txtUsername.SetFocus
SendKeys "{Home}+{End}"
end if
Last edited by Memnoch1207; Apr 4th, 2003 at 02:58 PM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|