Connecting to MySQL ODBC 3.51 with VB

  • 12 years ago
    Can someone please help me with the debugging of my code?
    I'm using VB for my codes, MySQL database and ODBC connector.
    Theres no error when run, but the system failed to establish a connection to the database records.
    What's wrong with my code?
    Plzz help. Thank you.

    <%@Import Namespace="System.Data" %>
    <%@Import Namespace="System.Data.SqlTypes" %>
    <%@Import Namespace="system.data.sqlClient" %>
    <%@Import Namespace="System.Web.Util" %>
    <%@Import Namespace="System.Data" %>
    <%@Import Namespace="System.Data.Odbc" %>

    Dim myString As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=slim;uid=root;pwd=fyp;option=3"
             Dim myConnection As OdbcConnection = New OdbcConnection(myString)
             Dim myCommand As OdbcCommand = New OdbcCommand("SELECT Name, Member_ID, Password FROM Member", myConnection)
             Dim myDataReader As OdbcDataReader
            
             myCommand.Connection = myConnection
             myCommand.Connection.Open()
             
             myDataReader = myCommand.ExecuteReader()
       
             myDataReader.Read()






















Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”