Wednesday, October 25, 2006

VS '05 and ASP.NET - watch out for this - ConnectionStrings*

Wednesday, October 25, 2006 9:08:22 PM (GMT Standard Time, UTC+00:00)

This post is to do with how VS'05/ASP.NET handles the DataSet and connection strings.

Today, I got the following error:

Error 39 Unable to convert input xml file content to a DataSet. Requested value 'ConnectionStrings' was not found.

The reason for this error was that I had named my ConnectionString JN.ConnectionString. Now looking at it, this seems a pretty normal name, however a problem arises because of the "." within that string's name. Apparently in the Connection element of the DataSet1.xsd (ie the DataSet file), mistakes the "." to mean something it shouldn't and thus generates the error I mentioned above. (More specifically it's this line: 'PropertyReference="...ConnectionStrings.JN.ConnectionString.ConnectionString"' - I show the problem in bold,red,underlined).

To fix this and also ensure that you never have the error mentioned, make it a RULE NEVER to include a "." (dot/full stop) in your connectionstring's name. So you'll have: 'name="JNConnectionString"' in your web.config and 'PropertyReference="...ConnectionStrings.JNConnectionString.ConnectionString"' in your DataSet1.xsd file.

(By the way, I didn't find this error on Google, so apparently it's only me that make this mistake. :()

Related posts:
Select a random row in MS SQL...
Regular expressions
VS2005, ASP.NET 2 & DLLs, DLLs..
MS's ASP.NET and.. PHP
2-way databinding cascading drop down lists within a FormView
ApplicationName Property when customising providers

Comments are closed.