SQL Error

Giarc86

Expert Member
Joined
May 28, 2008
Messages
1,243
Reaction score
4
I get this error on my aspx website, i am clueless as to what to do now, can anyone shed some light?
Thanks

Format of the initialization string does not conform to specification starting at index 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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) +1242
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +128
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +102
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +52
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +125
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +56
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +138
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.DetailsView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.DetailsView.EnsureDataBound() +181
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
 
hmmm, thats kinda like saying "i have erectile dysfunction, what is wrong?" :D

some more information perhaps? what type of DB are you connecting to? what is your connection string? a little bit of context code even? :)

EDIT: Found this: "The main cause of this type of error is may be you wrote the connection string inside the quotes like this"
using very bad google-fu
 
Ok basically its a blog site and it works perfectly when i just run it from the IDE..
But as soon as i upload it wont work as connectionstrings need to be changed in the web.config file, i change them but then the errors occur

My Config File before i uploaded when everything is working fine:

<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="ASPNETDBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Temp\PortfolioSiteComplete\App_Data\ASPNETDB.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="ConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="ASPNETDBConnectionString2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=&quot;C:\Documents and Settings\206010643\PortfolioSiteCompleteBlog\App_Data\ASPNETDB.MDF&quot;;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
 
You are using an incorrect format for your connection string.

I don't know if it's because you pasted the connection strings, but there are millions of spaces, such as "DataDirector y" and "C:\Docu ments and Settings" ???

Edward
 
Last edited:
I just copied and pasted that wrong, as that config file does work offline.. when i upload it it wont work

The spaces arent in the file
 
No it doesnt thats why i had to change the config file to look in local app data directory..but when i do change it it doesnt work
 
random idea... have you tried this?
http://www.connectionstrings.com/

i'm not familiar with connecting to MDF files directly like that. your connection string looks more like a Access DB connection (as in, point it to the physical file)

i'm more familiar with MSSQL or MySQL: e.g.
MySQL: "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3307;DATABASE=Mydatabase; USER=root;PASSWORD=Mypassword;OPTION=3" (this is for an ODBC connection)

using the above site you should be able to build the string easily.

if you want to test on your local box, try making a UDL file (create a .txt file, and rename to .UDL) and then test your connection string. you can select from a wide range of DB types (whatever your pc supports i think). when you happy that it works, open the UDL with notepad to reveal your connectionstring. i know you mentioned that it works on your local box, but perhaps these things can help you in the right direction
 
No it doesnt thats why i had to change the config file to look in local app data directory..but when i do change it it doesnt work
yeah, if you do not know the physical path of the file it might be a bit of a problem. as far as i know you cannot use relative paths in connectionstrings.

is there no way for you to find out what the full path of you uploaded project is? or somebody that you could bother for that information?
 
Yep thats why i had to change the config to point to the local db file.. so it would find it when hosted in the relevant directory on the server... but its not working and my deadline has passed lol so kinda passive now...
so i will just mess around till i find it sometime
Thanks to all who helped :)
 
Top
Sign up to the MyBroadband newsletter
X