代码之家  ›  专栏  ›  技术社区  ›  Deepak Tomar

MySQL数据库和ASP。网络全局连接

  •  0
  • Deepak Tomar  · 技术社区  · 7 年前

    <?xml version="1.0"?>
    <!--
        For more information on how to configure your ASP.NET application, please
        visit
        http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
        <system.web>
            <trust level="Medium"/>
            <customErrors mode="Off" defaultRedirect="Home.aspx"/>
            <compilation debug="true" strict="false" explicit="true"
                         targetFramework="4.0">
                <assemblies>
                    <add assembly="MySql.Data, Version=6.9.9.0, Culture=neutral,
                         PublicKeyToken=C5687FC88969C44D"/>
                </assemblies>
            </compilation>
        </system.web>
    </configuration>
    

    但现在我已经把这个网站和数据库上传到了全球服务器上,并在代码中加入了全球数据库连接。现在是网络代码。配置文件为

    <?xml version="1.0"?>
    <!--
        For more information on how to configure your ASP.NET application, please
        visit
        http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
        <connectionStrings>
            <add name="myConnectionString" connectionString= "Server=globalservername;
                 Database=databasename; Uid=userid; Pwd=passwd;"
                 providerName="MySql.Data.MySqlClient" />
        </connectionStrings>
        <system.web>
            <trust level="Medium"/>
            <customErrors mode="Off" defaultRedirect="Home.aspx"/>
            <compilation debug="true" strict="false" explicit="true"
                         targetFramework="4.0">
            </compilation>
        </system.web>
    </configuration>
    

    当我打开任何页面时,它会显示以下错误

    在我的项目的每个Visual Basic文件(连接字符串)中的这一行中:

    Dim SQLConnection As New MySqlConnection("Server=globalservername;
    Database=databasename; Uid=userid; Pwd=passwd;")
    

    2 回复  |  直到 7 年前
        1
  •  0
  •   Peter Mortensen icecrime    7 年前

    您可能缺少所需的DLL文件, MySQL.Data 在生产环境中。您可以使用NuGet包*MySQL。数据*然后构建和部署。

    或者,您可以放置MySQL。数据DLL文件在您的bin文件夹和部署。

        2
  •  0
  •   Peter Mortensen icecrime    7 年前

    Mysqlopen("db")