Hi all, i am a student. Currently working on a course project which i would like to have the login function. Could anyone of you here teach me or show me the sample code to VB on how to write a login code. The login will be connected to mysql database in user table, and how to encrypt the password. I have my sample code here, i will show you guys later.

Also, my question is how do i compare the userid and password that the user has input to the database to chech whether the user is existed in the database. And, how do i create a welcome message to tell the user if he/she has been login successfully. Thanks

below are my simple login code:

Private Sub cmdLogin_Click()
Dim cnMySql As New rdoConnection
Dim sConnect As String
Dim sADOConnect As String
Dim sDAOConnect As String


sConnect = sConnect & "UID=" & txtUserID.Text & ";"
sConnect = sConnect & "Password=" & txtPassword.Text & ";"

cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = sConnect & _
"driver={MySQL ODBC 3.51 Driver};database=bus;dsn='';"
cnMySql.EstablishConnection
'cnMySql.Connect

'Load



'If cnMySql.Connect Then
MsgBox "Conglatulation " & txtUserID.Text & ", connection established."
'End If
Load frmvb6Mysql


'sADOConnect = "PROVIDER=MSDASQL;" & sDSN & sConnect
'sDAOConnect = "ODBC;" & sDSN & sConnect
End Sub

any help will do a lot. thanks in advance