MySql .net ADO - How to use with VS2008

M

Mark Worsnop

I need to access both SQL Server and MySql in my application. I started by
using the OLEdb connection and that works.

However I want to stay with the SQL Natiive drivers. The SQL side of the
app looks like it will be ok.

For the MySql side I got the latest MySql .NET
but it doesnt seem to have a data adapater and such like SQL Server native
does.

Like
Dim CN as new SqlConnection
this doesnt work with the MySql drivers.

Sorry for the dumb questions, I am a newbie at .Net and trying to get up to
speed.
 
W

William \(Bill\) Vaughn

Well, once you install and register the MySQL .NET data provider you'll be
able to

Import MySQLStuff ' of course I have no idea what their namespace
looks like...

Dim cn as New MySqlConnection ' And the namespace would show up in
Intellisense... but you have to add it to the Project References.

hth

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
M

Mark Worsnop

I did install it and it shows up etc as expected. But all it has is DATA and
nothing else.

I guess for now I will make the connection for SQL native, and use OleDB for
the MySql. I am still wondering though if this is actually ADOc?
 
W

William \(Bill\) Vaughn

No, when you use the OleDb namespace to access SQL Server, it does not
invoke the MDAC stack or COM-based ADO (ADOc). It does use the same (or a
similar) SQL Server OLE DB provider just like ADOc does. ADOc is an entirely
different set of data access interfaces that implement server-side cursors,
the Recordset and all the other functionality you've used with ADOc over the
years.


--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
W

William \(Bill\) Vaughn

I wrote a simple (but not functional) sample that might help get you
started:

Imports MySql.Data
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Dim cncsb As New MySqlClient.MySqlConnectionStringBuilder
With cncsb
.Database = "C:\ibdata1"
.UserID = "root"
.Password = "root"
End With
Dim cn As New
MySqlClient.MySqlConnection(cncsb.ConnectionString)
cn.Open()

Catch ex As Exception
MsgBox(ex.ToString)
End Try

hth
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
 
M

Mark Worsnop

Thanks again for the help. I am going to use the OleDB for the MySql and the
Net native for SQL. Also thanks for the example, already have all the
connections working, but just need to make sure I am using the proper tools.

Take Care
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top