Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 初始化字符串的格式不符合从索引0开始的规范不起作用_Asp.net_Sql Server - Fatal编程技术网

Asp.net 初始化字符串的格式不符合从索引0开始的规范不起作用

Asp.net 初始化字符串的格式不符合从索引0开始的规范不起作用,asp.net,sql-server,Asp.net,Sql Server,我已经读了所有关于这个的文章,但没有找到任何问题的答案。我尝试过不同的连接,但没有运气 我试过很多东西,但我不知道是什么原因造成的?有没有人遇到过同样的问题并找到了解决方案 首先是我的堆栈跟踪 堆栈跟踪: [ArgumentException: Format of the initialization string does not conform to specification starting at index 0.] System.Data.Common.DbConnectionOpt

我已经读了所有关于这个的文章,但没有找到任何问题的答案。我尝试过不同的连接,但没有运气

我试过很多东西,但我不知道是什么原因造成的?有没有人遇到过同样的问题并找到了解决方案

首先是我的堆栈跟踪

堆栈跟踪:

[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) +5081160
 System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +132
 System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
 System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +64
 System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
 System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
 System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
 System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
 System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +34
 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +117
 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
 System.Web.UI.WebControls.GridView.DataBind() +4
 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
 System.Web.UI.Control.EnsureChildControls() +102
 System.Web.UI.Control.PreRenderRecursiveInternal() +42
 System.Web.UI.Control.PreRenderRecursiveInternal() +175
 System.Web.UI.Control.PreRenderRecursiveInternal() +175
 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
网络配置

  <connectionStrings>
  <add name="riktigaconnstringen" connectionString="Data Source=aspx-XXXXX.mssql.binero.se;Initial Catalog=XXXX-aspx;Persist Security Info=True;User ID=XXXX;Password=XXXXX"/>

和我的页面

 <asp:SqlDataSource 
        ID="test1" 
        runat="server" 
        DataSourceMode="DataSet"
        SelectCommand="SELECT * FROM t_produkter"
        ConnectionString="<% ConnectionStrings:riktigaconnstringen %>"></asp:SqlDataSource>
 </connectionStrings>

我不确定这是否是问题的原因,但在SqlDataSource的MSDN示例中,我可以看到引用ConnectionString的不同语法

  <asp:SqlDataSource
      ID="test1"   
      runat="server"   
      DataSourceMode="DataSet"  
      SelectCommand="SELECT * FROM t_produkter"  
      ConnectionString="<%$ ConnectionStrings:riktigaconnstringen %>"></asp:SqlDataSource
  </asp:SqlDataSource>

的确如此!谢谢你帮我摆脱了失明!!嘿,好的。问题,如何将函数放在sqldatasource上。我有一个加密/解密connectionstring的函数。类似于解密(connString)的东西。。我想对sqldatasource进行解密,我该怎么做?检查此链接-->,,,干杯,@Haminteu你应该发布一个新问题。