我開發了一個網站,其中使用了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