SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for September, 2011

Error message when you start SQL Server 2005 Management Studio: “Input string was not in a correct format”

Symptoms
When you start Microsoft SQL Server 2005 Management Studio, you may receive the following error message:

Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
Input string was not in a correct format.If you click Detail in the dialog box, the following error message text appears at the top of the details:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.LoginControl.InitFromLastUsedServerType()
at Microsoft.SqlServer.Management.UI.ConnectionDlg.ConnectionDialog.DoOneTimeInitialization()
at Microsoft.SqlServer.Management.UI.ConnectionDlg.ConnectionDialog.OnVisibleChanged(EventArgs e)
at Microsoft.SqlServer.Management.UI.VSIntegration.ShellConnectionDialog.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Resolution
This problem occurs if the value of the following registry key is not empty or is set to an invalid value:
HKEY_CURRENT_USER\Control Panel\International\sPositiveSign

Error message when you install SQL Server 2005 on a computer that is running the original release version of Windows XP: “This application has failed to start because the application configuratio …

Symptoms
When you install Microsoft SQL Server 2005 on a computer that is running the original release version of Microsoft Windows XP, you receive the following error message:

This application has failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem.Additionally, the following event is logged in the System log:
Source: SideBySide
Event ID: 59
Description:
Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The system cannot find the file specified.
Resolution
This problem occurs because SQL Server 2005 requires the GetSystemTimes function. The GetSystemTimes function is included in Windows XP Service Pack 1 (SP1) and inlater Windows XP service packs.

Error message when you execute a CLR routine or use an assembly in SQL Server 2005: “Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0×80131050)”

Symptoms
Consider the following scenarios.
Scenario 1You create a common language runtime (CLR) routine that references a Microsoft .NET Framework assembly. The .NET Framework assembly is not documented in Knowledge Base article 922672. Then, you install the .NET Framework 3.5 or a .NET Framework 2.0-based hotfix.
Scenario 2You create an assembly, and then you register the assembly in a Microsoft SQL Server 2005 database. Then, you install a different version of the assembly in the Global Assembly Cache (GAC).
When you execute the CLR routine or use the assembly from either of these scenarios in SQL Server 2005, you receive an error message that resembles the following:

Server: Msg 6522, Level 16, State 2, Line 1
A .NET Framework error occurred during execution of user defined routine or aggregate ‘getsid’:
System.IO.FileLoadException: Could not load file or assembly ‘System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0×80131050)
System.IO.FileLoadException:
Resolution
When the CLR loads an assembly, the CLR verifies that the same assembly is in the GAC. If the same assembly is in the GAC, the CLR verifies that the Module Version IDs (MVIDs) of these assemblies match. If the MVIDs of these assemblies do not match, you receive the error message that the “Symptoms” section mentions.
When an assembly is recompiled, the MVID of the assembly changes. Therefore, if you update the .NET Framework, the .NET Framework assemblies have different MVIDs because those assemblies are recompiled. Additionally, if you update your own assembly, the assembly is recompiled. Therefore, the assembly also has a different MVID.