使用asp.NET连接字符串登录MySQL数据库失败

时间:2015-05-05 05:28:54

标签: php mysql asp.net connection-string

我正在尝试访问我通过phpMyAdmin创建的数据库。我想要做的就是通过gridview显示其中一个表。但是,当我尝试通过我的web.config文件创建连接字符串时,我收到此错误:

[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
   System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5360365
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +124
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
   System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +34
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +113
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +138
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

我无法访问错误日志,虽然我已联系过数据库管理员,正在等待他们的回复,看看我是否可以访问。

我的连接字符串是:

<connectionStrings>    
  <add name="TheRegistrationConnectionString"         
connectionString="Server=127.0.0.1;Database=faltesek__dahcookiejar;Uid=falte_aaron;Pwd=xxxxx;"
  providerName="System.Data.MySqlClient"
     />      

数据库服务器信息是:

服务器版本:5.1.73-community - MySQL社区服务器(GPL)

我试过四处寻找以确保我的连接字符串格式正确。我尝试了十几种不同的格式,但似乎无法正常工作。在我访问服务器错误日志之前,我想也许有人可以看到我正在做的事情的明显问题。

提前致谢!

1 个答案:

答案 0 :(得分:0)

您是否已将相应的MySQL .NET Connector库添加到项目参考中?  http://dev.mysql.com/downloads/connector/net