Zeni
Zeni

Reputation: 997

MySql from VS 2017 Unable to create Entity Models from database

I am unable to create Entity Models from database.

It is first time using MySQL from VS2017.

I am following tutorial at

1) https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-intro.html

2) https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-entity-framework-winform-data-source.html

3) https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html

I installed MySQL on local machine. I installed NuGet packages MySql.Data, MySql.Data.Entity, and MySql.Web (all version 6.9.11).

In tutorial No.2, while adding “ADO.Net Entity Data Model”, I get upto this window

enter image description here

I click next and then window silently close without producing any Data Models.

This means I don’t see the window below.

enter image description here

I assume my connection strting and web.config file is OK as I can successfully execute code bellow and get result “Samoa -- Malietoa Tanumafili II”

`

using System;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;

public class Tutorial2
{
    public static void Main()
    {
        string connStr = "server=localhost;user=root;database=world;port=3306;password=******";
        MySqlConnection conn = new MySqlConnection(connStr);
        try
        {
            Console.WriteLine("Connecting to MySQL...");
            conn.Open();

            string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent='Oceania'";
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                Console.WriteLine(rdr[0]+" -- "+rdr[1]);
            }
            rdr.Close();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }

        conn.Close();
        Console.WriteLine("Done.");
    }
}`      

Please guide what I am doing wrong.

Upvotes: 0

Views: 453

Answers (1)

Bradley Grainger
Bradley Grainger

Reputation: 28207

This is a known bug in MySQL Connector/NET: bug 89338. According to that bug report, there's a bug in the wizard code that should be fixed in the next version, 6.10.7.

Upvotes: 1

Related Questions