Hi all

Ive been working on a VW2005 project and constantly been getting the following error message... Ive been debugging the program for quite some time now and still cant figure out where the problem lies...

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) +1284
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +115
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +99
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +52
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +25
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +141
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +38
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +128
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +13
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68
   System.Web.UI.WebControls.GridView.DataBind() +5
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67
   System.Web.UI.Control.EnsureChildControls() +97
   System.Web.UI.Control.PreRenderRecursiveInternal() +50
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5729

Any help with thatv??

It looks like your connection string is the issue

It should look like

Data Source=SERVERNAME;Initial Catalog=DATABASENAME;UID=USERNAME;PWD=PASSWORD

If this is not the issue could you then post the ConnectionString and the SQL Statment

This is my connection string from my web.config file...

Um...Im not sure where the problem could be lying because this connection was generated by the system...I didnt do any tweaking myself...

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Ratios.mdf;Integrated Security=True;User Instance=True"

You will notice that my database name is Ratios...

the connection string that you have sent is just attaching the database file to the server and is not trying to open the database.

change the connection string to the following :
Data Source=SERVERNAME;Initial Catalog=DATABASENAME;UID=USERNAME;PWD=PASSWORD

The above will only work if you are trying to connect to the database.

Bharat

This is my connection string from my web.config file...

Um...Im not sure where the problem could be lying because this connection was generated by the system...I didnt do any tweaking myself...

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Ratios.mdf;Integrated Security=True;User Instance=True"

You will notice that my database name is Ratios...

This would make your ConnectionString

connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Ratios;Integrated Security=True;User Instance=True"

I still get the same error even after changing the connection string...

Try the following

strConnect = "Driver={SQL Server};Server=<server address>;Database=<database>;UID=;PWD="

OR

connectionString="Data Source=DSN Name;Initial Catalog=Ratios;Integrated Security=True;User Instance=True"

I still get the same error even after changing the connection string...

Try the following

strConnect = "Driver={SQL Server};Server=<server address>;Database=<database>;UID=;PWD="

OR

connectionString="Data Source=DSN Name;Initial Catalog=Ratios;Integrated Security=True;User Instance=True"

I tried the latter code, i still get the same error, I didnt try the former cos im not sure about the "SQL Server" and the "server address" or do i just copy and paste it exactly like that ??

Try the following

strConnect = "Driver={SQL Server};Server=<server address>;Database=<database>;UID=;PWD="

OR

connectionString="Data Source=DSN Name;Initial Catalog=Ratios;Integrated Security=True;User Instance=True"

I tried the latter code and i still get the same error, I didnt try the former cos im not sure about the "SQL Server" and the "server address" or do i just copy and paste it exactly like that ??

Thanks

I finally decided to resort back to the previous working code as i was getting agitated with errors i was getting...

I want to be able to select a particular industry and show results only for that specific industry after selecting it from the dropdown list, this is what has been causing problems for me because i tried to use a code segment that gave me errors, I deleted it and resorted back to the original

Here is sample of how the UI looks like

[IMG]http://i170.photobucket.com/albums/u268/yagapapa/ChooseIndustry.jpg[/IMG]

As you can see i have two industries, but i want to show ratios for only the one selected...

I tried the latter code, i still get the same error, I didnt try the former cos im not sure about the "SQL Server" and the "server address" or do i just copy and paste it exactly like that ??

for the latter code you woul have to make a DSN in your computer which points to the database file

This article has been dead for over six months. Start a new discussion instead.