systems0nemesis
Programmer
I am new to vb6 and what I am making is a program that when run ask for a user ID and password it then looks up in the database and makes sure the user and password is there. I can get it to connect to the database and it will verify the user and password but I need a way for the user to enter that database server address because because they will be accessing diffrent server databases. How would I go about doing this? Also I would like to add a way to the program where the login checks to make sire the user and password have not been band. I hope this is not to much trouble. I have been looking around and have not see much for mysql, maybe I over looked it but any help would be nice. Thanks very much here is the login code
Private Sub cmdOK_Click()
Dim conn As adodb.Connection
Dim rs As New adodb.Recordset
Dim fld As adodb.Field
Dim sql As String
'connect to MySQL server using MySQL ODB
' C 3.51 Driver
Set conn = New adodb.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=test; UID=test; PWD=test; OPTION=3"
conn.Open
sql = "select * from accounts Where User='" & User & "' AND Password='" & Password & "'"
rs.Open sql, conn
If rs.EOF = True Then
MsgBox "Invalid User or Password, try again!", , "Login"
User.SetFocus
SendKeys "{Home}+{End}"
Else
MsgBox "Welcome, " & User
me.hide
End If
End Sub
Private Sub cmdOK_Click()
Dim conn As adodb.Connection
Dim rs As New adodb.Recordset
Dim fld As adodb.Field
Dim sql As String
'connect to MySQL server using MySQL ODB
' C 3.51 Driver
Set conn = New adodb.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=test; UID=test; PWD=test; OPTION=3"
conn.Open
sql = "select * from accounts Where User='" & User & "' AND Password='" & Password & "'"
rs.Open sql, conn
If rs.EOF = True Then
MsgBox "Invalid User or Password, try again!", , "Login"
User.SetFocus
SendKeys "{Home}+{End}"
Else
MsgBox "Welcome, " & User
me.hide
End If
End Sub