hello frnz...How to code for a login form by taking data from Oracle db?
M having a table Employee having attribute as emplogin and emppwd...from there i want to check that whether the user has entered the correct data or not...
I mean i want to match the entered data with that of the data in database.
Plz help me out with this...as m new to VB6.

This is a simple coding when the id and pswd is USER

Private Sub cmdlogin_Click()
If txtlogin.Text = "user" And txtpwd.Text = "user" Then
frmprjlist.show
Unload Me
Else
MsgBox ("Login Failed! Try Again....")
Me.Refresh
End If

End Sub


Thanx in advance...

Recommended Answers

All 4 Replies

Yo need to use COUNT function in oracle by passing the username and password from frontend. If this returns 1 then only allow to login else re-prompt for correct username and password.

Hi,

You need an ADO Connection object and a Recordset object .
First open the Connection to the Oracle database.
and open a Recordset with this Query:
"Select * From Login_Info_Table Where UserName = '" & txtUser.Text & "'" And Pwd = "'" & txtPwd.Text & "'"

If the above query returns any Records, then you allow the user to login..

Regards
Veena

Yo need to use COUNT function in oracle by passing the username and password from frontend. If this returns 1 then only allow to login else re-prompt for correct username and password.

I use this function and here is the code..
i knw, m wrong.
will u plz help me out

If Adodc1.Recordset.RecordCount <> 0 Then
'Adodc1.Recordset.MoveLast
'Adodc1.Recordset.MoveFirst
'Adodc1.RecordSource = "select emplogin, emppwd from employee"
'Adodc1.Recordset.Find "Empid='" & Trim(txtlogin.Text) & "'" ??????

'End If

waiting 4 ur reply
Era

Hi,

You need an ADO Connection object and a Recordset object .
First open the Connection to the Oracle database.
and open a Recordset with this Query:
"Select * From Login_Info_Table Where UserName = '" & txtUser.Text & "'" And Pwd = "'" & txtPwd.Text & "'"

If the above query returns any Records, then you allow the user to login..

Regards
Veena

h'lo veena

i followed the instruction given by u
bt again i think..m wrong somewhere as i hv include few codes by myself
here is the code

'If Adodc1.Recordset.RecordCount <> 0 Then
'Adodc1.Recordset.MoveLast
'Adodc1.Recordset.MoveFirst
Adodc1.RecordSource = "select * from employee where Emplogin = '" & txtlogin.Text & "'" And Emppwd = "'" & txtpwd.Text & "'"
'Else
'MsgBox ("Login Failed! Try Again....")
'Me.Refresh
'End If

Plz do suggest me...where m wrong...;) :P

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.