I have read all threads about this without finding any answer to my problem. I have tried with different connections string with no luck?
I have tried many things but I dont know what causes this? Has anyone had the same problem and found a solution?
First of this is my stack trace
Stack Trace:
[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
WEB CONFIG
<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"/>
AND MY PAGE
<asp:SqlDataSource
ID="test1"
runat="server"
DataSourceMode="DataSet"
SelectCommand="SELECT * FROM t_produkter"
ConnectionString="<% ConnectionStrings:riktigaconnstringen %>"></asp:SqlDataSource>
</connectionStrings>
I’m not sure if this is the cause of your problem, but in the MSDN example for SqlDataSource I can see a different syntax for referencing the ConnectionString
Note the
$char after the<%