Microsoft KB Archive/884871

= FIX: The Server property may return as an empty string when you receive the SQLException object in the .NET Framework 1.0 and in the .NET Framework 1.1 =

Article ID: 884871

Article Last Modified on 6/1/2006

-

APPLIES TO


 * Microsoft .NET Framework 1.0
 * Microsoft .NET Framework 1.1

-





SYMPTOMS
You can use the Microsoft .NET Framework 1.0 and the .NET Framework 1.1 to create an instance of the SQLConnection class on the computer that is running Microsoft SQL Server 2000. However, if the SqlException object is raised, the Server property of the SqlException object is not set. The Server property returns an empty string. The Server property is supposed to contain the name of the instance of the computer that is running SQL Server that the associated SqlConnection class is connected to.



How to obtain the hotfix
This issue is fixed in the Microsoft Visual Studio .NET Hotfix Package 3151. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

887549



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Steps to reproduce the problem
Use the following C# code sample to create a console application to reproduce the problem. SqlConnection nwindConn = new SqlConnection(&quot;Data Source=server;uid=uid;pwd=pwd;&quot;);

SqlCommand salesCMD = new SqlCommand(&quot;dbo.prc_not_a_real_sproc&quot;, nwindConn); salesCMD.CommandType = CommandType.StoredProcedure;

try {   nwindConn.Open; salesCMD.ExecuteReader; } catch(SqlException ex) {   Console.WriteLine(&quot;SqlExceptionServer=&quot; + ex.Server); foreach (SqlError sqlError in ex.Errors) {       Console.WriteLine(&quot;SqlError Server: &quot; + sqlError.Server); } } Console.Read;

Keywords: kbtshoot kbbug kbfix kbqfe kbhotfixserver KB884871

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.