2016-09-22 1 views
1

のMySQLのC#との接続Entity Frameworkの、エラー:私は、Visual Studio 2012</p> <p>そしてこのすべてがうまくいっている中でエンティティFramworkでMySQLに接続するために必要なすべてのを設定している

は、私は私のテーブルのマッピングを取得します私のコードでは、ここ

が私のコードです:

0:実行中

using (testuserEntities context = new testuserEntities()) 
     { 
      personels nam = context.personels.FirstOrDefault(x => x.name == "Walid"); 
      if (nam !=null) 
      { 
       textBox1.Text = nam.name; 
      }     
     } 

、私はエラーを取得します

enter image description here

Thnaks、

接続文字列:

<connectionStrings> 
<add name="testuserEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;password=root;persistsecurityinfo=True;database=testuser&quot;" providerName="System.Data.EntityClient"/> 

私のテーブル:

enter image description here

+0

あなたはあなたの '接続文字列'と 'context'クラスを共有できますか? – Sampath

+0

http://stackoverflow.com/a/19898907/6356434 – Alex

+0

また、 'models'の' code'ですか? – Sampath

答えて

2

私はsolutioを見つけますN: 私たちは、DLLを更新する必要があります。

1)を右クリックしてソリューションに(ソリューションエクスプローラでトップレベル)

2)

3溶液のためNugetパッケージ管理)を更新します(探し

:私たちはApp.configファイルの変更を持って、Entity.Framwork

をMySql.Data、MySql.Data.Entities:左)

4)パッケージを更新中

<system.data> 
<DbProviderFactories> 
    <remove invariant="MySql.Data.MySqlClient" /> 
    <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> 
</DbProviderFactories> 

私のために働きます!

関連する問題

 関連する問題