简体   繁体   English

如何在Visual Web Developer 2010 Express中从数据库更新模型?

[英]How to update model from database in Visual Web Developer 2010 Express?

I have an existing model for a MySQL database. 我有一个MySQL数据库的现有模型。 I've added a new table in my database and now I want to update the model. 我在我的数据库中添加了一个新表,现在我想更新模型。

But when I right-click in the Model browser and select Update Model from Database... I get following message: 但是,当我在模型浏览器中右键单击并从数据库中选择更新模型时......我收到以下消息:

An exception of type 'Microsoft.VSDesigner.Data.Local.ConnectionStringConverterServiceException' occurred while attempting to update from the database. The exception message is: ''.

Application works just fine with existing model. 应用程序适用于现有模型。 I mean, data is successfully fetched when needed and all. 我的意思是,在需要时和所有数据都成功获取数据。

What might cause the problem with updating the model? 什么可能导致更新模型的问题? Is it because of Express edition? 是因为Express版吗? How can I resolve the problem? 我该如何解决这个问题?

UPDATE: 更新:

<connectionStrings>    
    <add name="OtherDbDataContext" connectionString="metadata=res://*/DataAccess.EF.OtherDb.csdl|res://*/DataAccess.EF.OtherDb.ssdl|res://*/DataAccess.EF.OtherDb.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;User Id=id;Password=password;Host=localhost;Database=otherdb;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;Persist Security Info=True&quot;" providerName="System.Data.EntityClient" />
    <add name="DbDataContext" connectionString="server=localhost;User Id=id;password=password;Persist Security Info=True;database=db" providerName="MySql.Data.MySqlClient" />
    <add name="DbDataConnectionString" connectionString="server=localhost;User Id=id;password=password;Persist Security Info=True;database=db" providerName="MySql.Data.MySqlClient" />
</connectionStrings>

Solved this problem by deleting all connectionstrings from config file. 通过从配置文件中删除所有连接字符串解决了此问题。 After that when you update model it prompts you to add connectionstrings and everything is working normally. 之后,当您更新模型时,它会提示您添加连接字符串,一切正常。

Hope it helps. 希望能帮助到你。

I think the problem is that the connector/net for mysql doesn't fully support express versions. 我认为问题是mysql的连接器/网络不完全支持快速版本。 Take a look at this post: Mysql - Visual Web Developer - Entity Framework 看一下这篇文章: Mysql - Visual Web Developer - Entity Framework

My problem with this was related to the Event Log full. 我的问题与Event Log已满有关。 Deleted event log entries and that solved the problem. 删除了事件日志条目,解决了问题。 Hope it helps someone. 希望它可以帮助某人。

Try updating the lowest config level closest to the .edmx file which is the app.config. 尝试更新最接近.edmx文件的最低配置级别,即app.config。 All in all the problem is connection related and not a problem in the designer IDE. 总而言之,问题是连接相关而不是设计器IDE中的问题。

Same issue with Visual Studio 2012 Professional. 与Visual Studio 2012 Professional相同的问题。 After removing connection string from App.config, I cannot add new connection in "Update from database" window. 从App.config中删除连接字符串后,我无法在“从数据库更新”窗口中添加新连接。 MySQL Data source was missing. MySQL数据源丢失了。

Solved by installing MySQL for Visual Studio (for me it was 1.1.3 version). 通过为Visual Studio安装MySQL来解决(对我来说它是1.1.3版本)。 I had the opportunity to create connections to MySQL database. 我有机会创建与MySQL数据库的连接。 I revert connection string and even with old connection string all was fine. 我恢复连接字符串,甚至旧连接字符串都很好。

Hope it helps. 希望能帮助到你。

You need to register your provider in machine.config file. 您需要在machine.config文件中注册您的提供程序。 This happens when the provider is not properly registered in the machine.config file. 如果提供程序未在machine.config文件中正确注册,则会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM