I have a Windows XP SP2 PC that I installed SQL Server 2005 and Visual Studio 2005 on soon after both products were RTM’d. For months thereafter, I encountered two odd errors with both products:
1. Every time I created a new connection using SQL Server Management Studio, I would get the following obscure error:
"An error has occurred while establishing a connection to the server."
After acknowledging the error, I could continue working in Management Studio without difficulty. I didn’t find much on the various search engines on this. The primary cause was having beta versions of SQL Server 2005 installed; however, I had not installed any beta versions on this PC.
2. Every time I attempted to create a new data source using the wizard in Visual Studio 2005, I would get the following obscure error:
"Input string was not in the correct format."
In this case, the data source wizard would not let me proceed. Again, I didn’t find much on the various search engines on this. One cause was having beta versions of Visual Studio 2005 installed; however, I had not installed any beta versions on this PC.
Over the ensuing months, I would periodically search for both of these errors. Finally, individuals on microsoft.public.dotnet.framework.aspnet reported the same error message and a similar error–"0 is not a valid value for Int32"–when attempting to compile their projects. Soon after that, someone replied that they submitted a case to Microsoft on this and received the following fix:
1. Exit out of Visual Studio 2005.
2. Launch REGEDIT.
3. Backup the computer’s registry settings by doing an export on the
4. Check the current setting for HKEY_CURRENT_USER > Control Panel > International > sPositiveSign. It is probably blank.
5. Change the setting to two double quotes ("").
6. Exit REGEDIT.The explanation from Microsoft: "This issue is due to corruption of a registry key’s value that deals with globalization settings. The registry key "sPositiveSign" under HKEY_CURRENT_USER\Control Panel\International should be blank for this to work correctly. If this is set to 0 the above exception will occur. Change this value to " " in the registry key to correct this exception. Note that whenever the value that is parsed is the same as the value for the ‘sPositiveSign’ item this exception is thrown. Normally this error happens only if there is an entry "0" for the sPositiveSign registry settings. If any program modified the regional settings to a bad value, this issue will also occur. Please have a look at this article Bug Details: int.Parse can fail unexpected if user’s regional settings are corrupt."
The problem sounded close-enough to what I was experiencing–so I checked the sPositiveSign on this PC. It was blank, indicating corruption! I changed the value to two double quotes. This fixed both of the problems I was experiencing–the one in Visual Studio 2005 and the one in SQL Server 2005!
Just goes to show that with so many users out there and with so many disparate configurations, someone else has likely encountered–and solved–any PC problem you may be having!
I never determined how the setting became ‘corrupt’ on this PC. Considering the many references to problems resulting from having beta versions installed, I suspect the problem has something to do with SQL Server 2000 and Visual Studio 2003 being installed on this PC in the past. However, I have another PC that had SQL Server 2000 and Visual Studio 2003 installed in the past, has SQL Server 2005 and Visual Studio 2005 installed now, has a blank (i.e., ‘corrupt’) sPositiveSign value, and yet does not have these problems! Oh, well. So much for that theory!