【问题标题】:How to set connection string to MySQL database for ASP.NET tableadapter如何为 ASP.NET tableadapter 设置 MySQL 数据库的连接字符串
【发布时间】:2017-02-27 03:27:54
【问题描述】:

我的 Web.config 文件中有 2 个连接字符串。但是,当我在新数据集上添加新表适配器时,我无法从 Connection 属性下拉列表中选择 conn_wp 连接字符串。 conn_wp 连接的凭据是正确的,我在 MySQL Workbench 中对其进行了测试。

我在表格适配器的Connection 属性下看到了这些选项

  • conn1 (Web.config)
  • (新连接...)
  • (无)

但没有conn_wp 选项..我也无法在此字段中输入自己。

Web.config

  <connectionStrings>
    <add name="conn1" connectionString="data source=(local)\sqlexpress;Initial Catalog=mydb;User Id=myuser;Password=Mypwd;" providerName="System.Data.SqlClient" />
    <add name="conn_wp" connectionString="Server=localhost;Database=wpblog;Uid=myuser;Pwd=mypwd;Convert Zero Datetime=True" providerName="MySql.Data.MySqlClient" />
  </connectionStrings>

我已经安装了正确的连接器并将生成的MySql.Data.dll 包含到我的项目中,但也出现此错误:

【问题讨论】:

    标签: mysql asp.net dataset connection-string tableadapter


    【解决方案1】:

    您需要下载MySql Connector 并将其引用添加到您的项目中。

    您的连接字符串没有问题。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-18
    • 1970-01-01
    • 2014-03-18
    • 1970-01-01
    • 2016-09-15
    相关资源
    最近更新 更多