You can use the OleDB provider that ships with the .NET Framework. In this case, your
code would look something like this:
Dim connectString As string = _
"Provider=MySQLProv;Data Source=mydb;User Id=user;Password=pass"
Dim myConn As System.Data.OleDb.OleDbConnection = _
New System.Data.OleDb.OleDbConnection( connectString )
Try
myConn.Open()
`dosomething and then be sure to close the connection...
Finally
If Not myConn Is Nothing Then
myConn.Close()
End If
End Try
Another option is to use the MySQL data provider by eInfoDesigns (which I have only
minimally examined). In which case, your code would look like so:
Dim connectString As string = _
"Data Source=server;Database=mydb;User ID=user;
->Password=pass;Command Logging=false"
Dim myConn As eInfoDesigns.dbProvider.MySqlClient.MySqlConnection = _
New eInfoDesigns.dbProvider.MySqlClient.MySqlConnection( connectString )
Try
myConn.Open()
'do something and then be sure to close the connection...
Finally
If Not myConn Is Nothing Then
myConn.Close()
End If
End Try
Comments
You can access most datasources with the OleDB data provider, although it's not the
most efficient way to do so.You get better performance using a custom data provider
dedicated to that particular datasource. Although Microsoft does not support a custom
MySQL data provider, third-party software vendors are beginning to supply these.
No comments:
Post a Comment