|
-
October 4th, 2005, 03:03 AM
#1
Connecting to mysql Database in vb.net
can anyone tell me how to connect to mysql database in vb.net
actually i tried as
imports system.data.odbc
imports system.data
Dim MyConString As String = "SERVER=server;DATABASE=x;UID=root;PASSWORD=x"
Dim MyConnection As New OdbcConnection(MyConString)
MyConnection.Open()
====
iwas searching on google i found that you can
imports mysql.data.mysqlclient
but i didnt find any class as mySql
pls help me
Keep Posting in this Forum 
-
October 4th, 2005, 04:07 AM
#2
Re: Connecting to mysql Database in vb.net
You can download mySQL drivers/libraries for .NET here.
- petter
-
October 4th, 2005, 04:25 AM
#3
Re: Connecting to mysql Database in vb.net
Just to extend on wildfrog's post a little, once you've downloaded that MySQL connector you can add the components it contains to the VS.NET Toolbox along with the SqlClient, OleDb, OdbcClient, etc. components. You can then add them to your forms or add a reference to the library to your peoject and create the objects in code. You can find the appropriate connection string to use with the MySqlConnection at www.connectionstrings.com.
-
October 5th, 2005, 12:11 AM
#4
Re: Connecting to mysql Database in vb.net
 Originally Posted by jmcilhinney
Just to extend on wildfrog's post a little, once you've downloaded that MySQL connector you can add the components it contains to the VS.NET Toolbox along with the SqlClient, OleDb, OdbcClient, etc. components. You can then add them to your forms or add a reference to the library to your peoject and create the objects in code. You can find the appropriate connection string to use with the MySqlConnection at www.connectionstrings.com.
ive already donwload and install that library but i didnt find any MySqlConnection provider in my VS.NEt Toolbox.
any idea to resolve this.
Keep Posting in this Forum 
-
October 5th, 2005, 12:15 AM
#5
Re: Connecting to mysql Database in vb.net
 Originally Posted by jmcilhinney
once you've downloaded that MySQL connector you can add the components it contains to the VS.NET Toolbox
It doesn't just happen by itself. Expand the Data tab on the Toolbox, right-click within it and select Add/Remove Items.
-
October 5th, 2005, 12:41 AM
#6
Re: Connecting to mysql Database in vb.net
 Originally Posted by jmcilhinney
It doesn't just happen by itself. Expand the Data tab on the Toolbox, right-click within it and select Add/Remove Items.
thnax i found the mysqlconnection
but when i m creating a connection through the code i m getting the following error.
"An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in mysql.data.dll
Additional information: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied"
=======My Code is======
Imports MySql.Data.MySqlClient
Dim MyConString As String = "SERVER=server;DATABASE=x;UID=root;PASSWORD=x;port=3030"
Dim myconn As New MySqlConnection(MyConString)
myconn.Open()
MsgBox(myconn.State.ToString())
=======
Keep Posting in this Forum 
-
October 5th, 2005, 12:56 AM
#7
Re: Connecting to mysql Database in vb.net
I think you're using the connection string for the MySqlConnection from eInfoDesigns. You want the one for Connector/NET 1.0.
-
October 5th, 2005, 01:00 AM
#8
Re: Connecting to mysql Database in vb.net
 Originally Posted by jmcilhinney
I think you're using the connection string for the MySqlConnection from eInfoDesigns. You want the one for Connector/NET 1.0.
ive installed net connector 1.0.6. can u explain the solution.
Keep Posting in this Forum 
-
October 5th, 2005, 01:06 AM
#9
Re: Connecting to mysql Database in vb.net
ive got the solution
now its works thanx alot all of you.
Keep Posting in this Forum 
-
October 5th, 2005, 01:08 AM
#10
Re: Connecting to mysql Database in vb.net
Go to www.connectionstrings.com, as I posted earlier, and look at the connection strings for MySQL. The one you are using matches the one for MySqlConnection from eInfoDesigns, but you should be using the one for Connector/NET 1.0, which is what you are now using.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|