I have been trying for about a week to connect VB6 to MySQL and have so far been unsuccessful. What I am trying to do is have a login system in VB6 which, when the login button is pressed, searches the "userlogin" table in MySQL. If a matching result is found for the username and password you can login, and if one isn't you can't. I have already created the table in MySQL and created the ODBC data source for it, I just don't know how to do the rest. I did try using the MSRDC, but that didn't help in this situation. Any and all help will be much appreciated :).

Using the ADODC1 or the MSRDC1 is not the best idea as you should use ADO, RDO, or DAO ODBC Direct with an ODBC DSN. However, with a visit to http://www.connectionstrings.com, you can use a DNS Less connection string with ADO (preferred technology by most people). Now, if you are shaky on using ADO, you can easily find a tutorial on ADO by using your friends (yahoo, google, ask, answers, bing) and searching for vb6 ado tutorial...

Good Luck

Right, I think I've connected to the database using the

ConnectString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                "SERVER=" & strServerName & _
                ";DATABASE=" & strDatabaseName & ";" & _
                "USER=" & strUserName & _
                ";PASSWORD=" & strPassword & _

function, but how do I know if it has connected correctly? is there some way to make a popup appear to show a successful login?

Also, how do I now excute SQL commands without using the MSRDC control?

Well once you try and connet, if the connection fails, you should get an error, if you do not get an error, then presumably, you have a good connection. Also, you should be able to test the connectionstate or whatever the property is to see if it is adstateopen/closed or whatever. Press F1 to see the help files on the subjects and the correct parameters to test against (see example if they have one)...

Good Luck

imedeately after you have opened your connection it should give you an error that the connection has failed and if does not give you an error that means that the connection was successfull that if you dont have any error hanlers that may suppress the errors or you could display a message with the state of the connection

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.