Tuesday, July 28, 2009

How do you access data in a MySQL Database using Visual Basic?

I'm trying to write a proggy in Visual Basic that retrieves information from a MySQL server. I already have a connection string, but I can't figure out how to load table values into a variable, or array so that I can use them in the proggy.





If someone can tell me how I can accomplish this it would be really appreciated. OBTW I am using VB5 Enterprise Edition.

How do you access data in a MySQL Database using Visual Basic?
You should be able to create recordsets via ADO:





Dim objConn = CreateObject("ADODB.Connection")


objConn.Open "Your Connection String"





Dim objRs = CreateObject("ADODB.Recordset")


objRs.Open "Your SQL Statement", objConn





Do Until objRs.EOF


Console.Write objRs("Some Field Name")


objRs.MoveNext


Loop


No comments:

Post a Comment