我开发了一个网站,其中使用了ASP.NET和VB.NET作为后端编程语言和MySQL数据库。我已经使用ASP.NET和MySQL数据库连接器在本地计算机上运行该网站,并且它工作正常。 web.config文件的代码下面给出:MySQL数据库和ASP.NET全局连接
<?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>
当我打开任何页面则显示以下错误
在这条线是在我的项目(连接字符串)的每一个Visual Basic文件编译器错误信息:BC30002:类型“的MySqlConnection”没有定义。
:
Dim SQLConnection As New MySqlConnection("Server=globalservername;
Database=databasename; Uid=userid; Pwd=passwd;")
我应该添加或删除在web.config文件中删除此错误?
另请参阅:https://stackoverflow.com/questions/29094224/type-mysqlconnection-is-not-defined – Palindromer