Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connect to MySQL through the Server Explorer

Status
Not open for further replies.

active

Programmer
Dec 10, 2000
9
US
I am trying to connect to MySQL through the Server Explorer and can't get to the data - I connect to the db, can view the tables and fields but when I try to drag a field onto the form I get the message "You cannot use an ole db provider for ODBC drivers". I use MyODBC, Visual Studio.NET 2003 with Windows XP Professional - any suggestions are greatly appreciated. Thank you.
 
You cannot use OLEDB (What you are dragging ) and use them with ODBC (myODBC) . If you are just trying to connect to a mySql DB here is the code. This is using a reader.

Dim myConnection As New OdbcConnection("driver={MySQL};server=myServer;uid=myUser;pwd=myPassword;database=myDatabase;OPTION=17923")
Dim sqlSelectCommand As New OdbcCommand
sqlSelectCommand.CommandText = " Select* from myTable"
sqlSelectCommand.Connection = myConnection
sqlSelectCommand.Connection.Open()

Dim mySR As OdbcDataReader = sqlSelectCommand.ExecuteReader
Dim cnt As Integer = 0
While mySR.Read
cnt += 1
lblCoCode.Text = mySR("Company_CD")
lblCoName.Text = mySR("CONAME")
lblCSR.Text = mySR("CSR_Code")
lblConName.Text = mySR("Contact_NA_D")
lblConPhone.Text = mySR("Contact_Phone_D")


End While

myConnection.close




DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Thank you for responding - I can connect through ODBC - I am sorry I wasn't clear enough. I read that someone connected to MYSql through the Server Explorer - I do it through ODBC. Is there any way I can connect to mysql through the Server Explorer so I can use the drag and drop functionality? Thank you again for your quick response.
 
The IDE probably doesn't know how to deal with your ODBC Connection. Why don't you try and see if you can bring up the connection another way (i.e., OLE DB) in server explorer and then drag tables, etc. onto the form. I don't use MySQL, so I don't know how good any of these providers are.

 
You need to purchase a mySql Provider. I think you can do it with mySql Direct. (I think that is the name of the provider.)

Here are a couple of links to providers



DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Yes - I have the ones from CoreLab but that doesn't give me the data in the server explorer. I read thread 796-638057 - she said she could do it and there are some nice features of the server explorer that are not supported by CoreLab. I was just wondering how she got the stuff working. I sent her an email in October but she never got back on tek-tips. Thank you for your responses - I really appreciate it :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top