【发布时间】:2017-07-08 07:11:03
【问题描述】:
我开发了一个网站,其中我使用了 ASP.NET 和 VB.NET 作为后端编程语言和一个 MySQL 数据库。我已经使用 ASP.NET 和 MySQL 数据库连接器在本地计算机上运行该网站,并且运行良好。 web.config文件的代码如下:
<?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>
但是现在我已经在全球服务器上上传了这个网站和数据库,并在我的代码中放置了全球数据库连接。现在 web.config 文件的代码是
<?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>
当我打开任何页面时,它会显示以下错误
编译器错误消息:BC30002:未定义类型“MySqlConnection”。
在我项目的每个 Visual Basic 文件中的这一行(连接字符串):
Dim SQLConnection As New MySqlConnection("Server=globalservername;
Database=databasename; Uid=userid; Pwd=passwd;")
我应该在 web.config 文件中添加或删除什么来消除此错误?
【问题讨论】:
标签: mysql asp.net asp.net-mvc vb.net mysql-error-1064