Connect a MYSql data connection on Visual Studio

How do i create a MySql database connection when the data source selection in Visual Studio 2008 Web Development does not include MySQL database connection.  I am trying to write a asp.net program in Visual Studio that connects to MySQL that is hosting on my hosting site.  However, there is no "MySQL Datasource " listed for me to select.
TAS-ITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>How do i create a MySql database connection when the data source selection in Visual Studio 2008 Web Development does not include MySQL database connection.

You need to install the MySQL .NET Connector, and then add it from Add References

You can download it from:

http://dev.mysql.com/downloads/connector/net/
0
TAS-ITAuthor Commented:
I was able to download and install the .NET Connector, but when i try to connect to my My SQL DB, i get the following error when i try to browse the tables in the Server Explorer of Visual Studio 9.0

Input String was not in a correct format.  Couldn't Store <Dynamic> in VERSION Column.  Expected type in UIn64
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
I'm not sure where and how you get that error....

btw, you can have connectionstring like this:

<connectionStrings>
    <add name="app_ConnString" connectionString="server=localhost;user id=root;password=password;persist security info=True;database=test;port=3306" providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>

then in your scripts:


using MySql.Data.MySqlClient;

...


MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["app_ConnString"].ToString());

String SQLStr = "Select * from yourTable";
MySqlCommand cmd =  new MySqlCommand(SQLStr, conn);

MySqlDataReader r = cmd.ExecuteReader(CommandBehavior.CloseConnection);

....


hope this helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

TAS-ITAuthor Commented:
I am able to connect to the database, but when I click on the TABLE from the Server Explorer, i get that error.
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try disconnect and reconnect your database?
0
TAS-ITAuthor Commented:
It might be the MySQL hosting Account.  I was able to query with it, but was not able to browse through the table with the Server Explorer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.