
06-21-2008, 02:34 AM
|
|
Centurion
|
|
Join Date: Feb 2007
Posts: 151
|
|
[SQL] Returning information as string
|
Hi there!
I've been working on this all day so far. It is the login information for my program, where the user inputs his/her username and password, and the program will connect to the database and check to see if the username and password match a record in the database.
Here's what I have so far.
Code:
Option Explicit
Public conn As New ADODB.Connection 'Connection to be used to mysql database
Public Function OpenConn(srvIP As String, dbNAme As String, dbUser As String, dbPass As String, dbPORT As Long, statusbox As StatusBar)
On Error GoTo errH
If conn.State <> 0 Then conn.Close 'Check if currently connected if yes, disconnect.
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & srvIP & ";DATABASE=" & dbNAme & ";" _
& "UID=" & dbUser & ";PWD=" & dbPass & "; PORT=" & dbPORT & "; OPTION=3"
conn.Open 'open the connection
Exit Function
errH:
statusbox.SimpleText = "Could not connect to server..."
End Function
Private Sub cmdLogIn_Click()
sb.SimpleText = "Connecting to server..."
OpenConn "98.XXX.X.XX", "databasename", "databaseloginusername", "dbpassword", "3306", sb
I don't know how to have it look up the txtusername.Text and txtpassword.Text fields in the database though. I get the connection, but I don't know the rest!
Is there a way to simply query for these two items and if it returns true, change the sb.SimpleText to "Log in details verified!"?
|
|