user4071320
user4071320

Reputation:

Use ADO.NET with MySQL in Visual Studio 2015

I want to use ADO.NET with MySQL, so I’ve installed MySQL Connector and MySQL for Visual Studio:

MySQL Installer window with MySQL Server 5.6.23, MySQL Workbench 6.2.4, MySQL Notifier 1.1.6, MySQL for Visual Studio 1.2.3, Connector/NET 6.9.5 and MySQL Documentation 5.6.23, all for X86 architecture

(I use Visual Studio 2015 and Windows 10) When I create a new ADO.NET, I don’t have MySQL:

EDM Assistant window with connection choice window

I don’t know how I can get MySQL to work with Entity Framework… I followed a tutorial, but it doesn’t work.

Upvotes: 17

Views: 34539

Answers (7)

Stephen C
Stephen C

Reputation: 791

This combination finally worked for me:
MySQL for Visual Studio - v1.2.6
MySQL Connector/Net - v6.9.8
(Visual Studio 2015 Community and Windows 10)

Solution Reference: MySQL Forumn - "Can't Create Datasource on VS2015"

Upvotes: 3

gregiolo
gregiolo

Reputation: 113

Had same problem but solved it

  • by running odbcad32.exe in windows\system32 directory and
  • Adding MySQL ODBC 5.3 ANSI Driver and
  • then pick Data Source in VS2015 .NET Framework Data Provider for ODBC

Upvotes: 0

Kulpemovitz
Kulpemovitz

Reputation: 541

I've been stuck with this issue many days I tried to install MySQL tool for Visual Studio from here

Everything is working now, Goodluck

Upvotes: 2

Stephan
Stephan

Reputation: 31

At the moment it is not possible. See info posted about EF 7 - Beta 4:

What’s Next

[...]

Providers

There is work underway to enable the following database providers. We’ve also had contact with many other providers who are planning to provide EF7 support.

  • SQLite (being developed by the EF team)
  • PostgreSql (being developed by the npgsql team)
  • MySql (being developed by the MySql team)

Upvotes: 3

pojomx
pojomx

Reputation: 790

You should use NuGet package for MySQL For Entity Framework

In Visual Studio 2015:

  • Tools
  • Nuget Package Manager
  • Manage NuGet Packages for Solution

Search for MySQL and install the desired one.
Rebuild and its ready

Upvotes: 2

Dejan Rajic
Dejan Rajic

Reputation: 121

From this release: http://dev.mysql.com/doc/relnotes/mysql-for-visual-studio/en/visual-studio-news-1-2-4.html it is possible.

In fact, I followed, and installed MySQL connector for Visual Studio 2015 correctly: http://dev.mysql.com/downloads/windows/visualstudio/

Upvotes: 7

Vitaly
Vitaly

Reputation: 2135

Just use the old way:

 var factory = DbProviderFactories.GetFactory(providerName);
 var conn = factory .CreateConnection();
 conn.ConnectionString = connectionString;
 var cmd = factory .CreateCommand();
 cmd.Connection = conn;
 cmd.CommandText = cmdText;
 .....

Of course put it all inside using, etc

Here is my provider and connection string

providerName = "MySql.Data.MySqlClient"
connectionString= "Server=localhost;Uid=root;Pwd=123456;Database=world;CharSet=utf8mb4"

I used Visual Studio 2015 RC Version 14.0.22823.1 D14REL, MySQL.Data Version 6.9.6.0, Windows 8.1 x64 Enterprise

Upvotes: 0

Related Questions