Cheeselord
asked on
Using local VB Program to connect to an online MySQL Database
Hello everyone, this is my first question on ExpertsExchange. However I've prowled around here and found the answers to most of the stuff I need to know. However, I haven't found the answer to this problem.
What I'm trying to do is use Visual Basic 6 to connect to an online MySQL database. It's for a login-scripts, I want it to first download your username and pass from the database, and then send the results to VB to see if log it is successful.
I also want to be able to download other stats about a user from the database, but I assume I can use the same type of script.
Any idea how I would going about doing this? This is a big thing, it should be worth more than 150 but that's all I have to give.
Thanks in advance for your help!
What I'm trying to do is use Visual Basic 6 to connect to an online MySQL database. It's for a login-scripts, I want it to first download your username and pass from the database, and then send the results to VB to see if log it is successful.
I also want to be able to download other stats about a user from the database, but I assume I can use the same type of script.
Any idea how I would going about doing this? This is a big thing, it should be worth more than 150 but that's all I have to give.
Thanks in advance for your help!
ASKER
By the way, I don't know most of the lingo. I have no idea what an API or an ADO or anything like that is. Please explain to a 4 year old, if possible. Huge thanks!
Hello,
I see you are a beginner (or on a mission). If you want to connect to SQL database you need to have a logon username and password. Perferably a superuser. Then you need to make a connection with the ADO connection object to the database and ececute a select statement to the database like: "Select username, password from user_table" with the user_table being the table that holds the info of all the users. If you wish to download other stats you need to learn the sql language so you can retrieve data from thye database. (DON'T TRY TO GET CORPORATE INFO, YOU CAN BE LOGGED). API and ADO are tow huge animals in VB. To learn them is up to you on how much you wnat to know. Read some book and articles on VB and Database. Check MSDN.
I see you are a beginner (or on a mission). If you want to connect to SQL database you need to have a logon username and password. Perferably a superuser. Then you need to make a connection with the ADO connection object to the database and ececute a select statement to the database like: "Select username, password from user_table" with the user_table being the table that holds the info of all the users. If you wish to download other stats you need to learn the sql language so you can retrieve data from thye database. (DON'T TRY TO GET CORPORATE INFO, YOU CAN BE LOGGED). API and ADO are tow huge animals in VB. To learn them is up to you on how much you wnat to know. Read some book and articles on VB and Database. Check MSDN.
Post email and I can send some articles.
ASKER
delcom, I already know how MySQL works, I'm just wondering how to connect to it with VB. I have a username and password and everything, I just don't know how to connect to the database on the server.
ASKER
Never mind, I got it to work using PHP, MySQL, and the webbrowser :D Thanks though.
ASKER
Um, I have one :D How do I close a question?
Post close question.
ASKER
Close question
Well, here's future reference info for those who come upon this question:
You will need the MyODBC ODBC driver and then just use a connection string:
MyODBC: http://www.mysql.com/downloads/api-myodbc-3.51.html
Sample connection code:
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.CursorLocation = adUseClient
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
& "DATABASE=test;" _
& "UID=testuser;" _
& "PWD=12345;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
conn.Open
rs.Open "SELECT * FROM mytable WHERE 1=0", conn, adOpenStatic, adLockOptimistic
Check www.vbmysql.com for samplecode and articles on the subject.
Regards,
Mike Hillyer
www.vbmysql.com
You will need the MyODBC ODBC driver and then just use a connection string:
MyODBC: http://www.mysql.com/downloads/api-myodbc-3.51.html
Sample connection code:
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.CursorLocation = adUseClient
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
& "DATABASE=test;" _
& "UID=testuser;" _
& "PWD=12345;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
conn.Open
rs.Open "SELECT * FROM mytable WHERE 1=0", conn, adOpenStatic, adLockOptimistic
Check www.vbmysql.com for samplecode and articles on the subject.
Regards,
Mike Hillyer
www.vbmysql.com
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ'd and pts refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
eslsys
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ'd and pts refunded
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
eslsys
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER