internal void mySQL()
{
string mySQLString = "DRIVER={MySQL};DATABASE=system;";
mySQLString += "SERVER=localhost;";
mySQLString += "UID=root;PWD=1234;";
System.Data.Odbc.OdbcConnection myDb = new OdbcConnection(mySQLString);
try
{
myDb.Open();
}
catch (System.Exception E)
{
MessageBox.Show(E.ToString());
}
}
Dim sDSN As String
Dim dt As New DataTable
Dim da As OdbcDataAdapter
Dim oConn As OdbcConnection
Dim cmd As New OdbcCommand
build the connection with parameters
sDSN = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=<Server Name>;DATABASE=<Database Name>;UID=root;PASSWORD=;OPTION=3"
Try
connect to the inherent MySQL connection
oConn = New OdbcConnection(sDSN)
cmd.CommandText = sSql
cmd.Connection = oConn
cmd.CommandTimeout = 0 allow for the timeout problem
da = New OdbcDataAdapter(cmd)
da.Fill(dt)
Catch ex As Exception
dt = Nothing
Return dt
End Try
da.Dispose()
oConn.Close()
oConn.Dispose()
Return dt