【问题标题】:How to update model from database in Visual Web Developer 2010 Express?如何从 Visual Web Developer 2010 Express 中的数据库更新模型?
【发布时间】:2011-12-28 14:14:07
【问题描述】:

我有一个 MySQL 数据库的现有模型。我在我的数据库中添加了一个新表,现在我想更新模型。

但是当我在模型浏览器中右键单击并选择从数据库更新模型时...我收到以下消息:

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

应用程序与现有模型配合得很好。我的意思是,在需要时成功获取数据。

什么可能导致更新模型出现问题?是因为Express版吗?我该如何解决这个问题?

更新:

<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>

【问题讨论】:

    标签: mysql asp.net-mvc-3 model mysql-connector


    【解决方案1】:

    通过从配置文件中删除所有连接字符串解决了这个问题。之后,当您更新模型时,它会提示您添加连接字符串,一切正常。

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      我认为问题在于 mysql 的连接器/网络不完全支持 express 版本。看看这个帖子:Mysql - Visual Web Developer - Entity Framework

      【讨论】:

      • 谢谢。刚刚检查了完整版的 Studio,一切都很完美。
      【解决方案3】:

      我的问题与Event Log full 有关。删除了事件日志条目并解决了问题。希望它可以帮助某人。

      【讨论】:

        【解决方案4】:

        您需要在 machine.config 文件中注册您的提供程序。当提供程序未在 machine.config 文件中正确注册时,会发生这种情况。

        【讨论】:

        • 我已将连接字符串添加到machine.config,但仍然显示相同的错误。
        • 您现在在 web.config 中使用哪个连接字符串??
        • 还尝试卸载和安装 MySQL 提供程序组件。这可能会解决问题
        • 重新安装也没有帮助
        • 这些问题对我来说是已知的问题......对不起,我帮不上忙......无论如何,我已经在asp.net mvc论坛上发布了这个问题。 ...如果我得到答案会更新你....
        【解决方案5】:

        尝试更新最接近 .edmx 文件的最低配置级别,即 app.config。 总而言之,问题与连接有关,而不是设计器 IDE 中的问题。

        【讨论】:

          【解决方案6】:

          Visual Studio 2012 Professional 也有同样的问题。从 App.config 中删除连接字符串后,我无法在“从数据库更新”窗口中添加新连接。 MySQL 数据源丢失。

          通过安装 MySQL for Visual Studio 解决(对我来说是 1.1.3 版本)。我有机会创建与 MySQL 数据库的连接。我恢复了连接字符串,即使使用旧的连接字符串也一切正常。

          希望对你有帮助。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多