BUG: One or more columns in the Results pane appear to be empty when you retrieve data in Visual Studio .NET or Visual Studio 2005 (884464)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Basic 2005
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition

SYMPTOMS

In Microsoft Visual Studio .NET or Visual Studio 2005, one or more columns in the Results pane appear to be empty when you retrieve data from a Microsoft SQL Server 2000 database table. This problem occurs when the following conditions are true:
  • The database table contains a column of type CHAR, NCHAR, VARCHAR, or NVARCHAR.
  • The column contains data that has more than 900 characters.

CAUSE

The cells of the Results pane in Visual Studio .NET or Visual Studio 2005 cannot display data that has more than 900 characters.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

If you use the VARCHAR data type for a column instead of the CHAR data type, and you use the NVARCHAR data type for a column instead of the NCHAR data type, the cell of the Results pane will display data that has up to 900 characters.

However, when you enter data that has more than 900 characters, the data will not appear in the cell of the Results pane. You will again notice that the cell of the Results pane is empty.

Steps to reproduce the problem

  1. Create a database table. To do this, follow these steps:
    1. Start SQL Query Analyzer.
    2. On the File menu, click New.
    3. Click Blank Query Window, and then click OK.
    4. Put the following code in the query window. This code creates the MyDatabase database and the MyTable table. All the columns of the first row in the MyTable table contain data that has 900 characters. All the columns of the second row in the MyTable table contain data that has 901 characters.
      DROP DATABASE MyDatabase
      GO
      CREATE DATABASE MyDatabase
      GO
      USE MyDatabase
      GO
      CREATE TABLE MyTable 
      (   Col1	char(1000)	NOT NULL,
          Col2	nchar(1000)	NOT NULL,
          Col3	varchar(1000)   NOT NULL,
          Col4	nvarchar(1000)   NOT NULL
      )
      SET NOCOUNT ON
      GO
      INSERT INTO MyTable VALUES
      (
        REPLICATE('1', 900),
        REPLICATE('2', 900),
        REPLICATE('3', 900),
        REPLICATE('4', 900)
      )
      GO
      INSERT INTO MyTable VALUES
      (
        REPLICATE('1', 901),
        REPLICATE('2', 901),
        REPLICATE('3', 901),
        REPLICATE('4', 901)
      )
      GO
  2. Create a database connection from Visual Studio .NET or from Visual Studio 2005. To do this, follow these steps:
    1. Start Visual Studio .NET or Visual Studio 2005.
    2. On the View menu, click Server Explorer.
    3. In Server Explorer, right-click Data Connections, and then click Add Connection. The Data Link Properties dialog box appears.

      Note In Visual Studio 2005, click Add Connection.
    4. In the Data Link Properties dialog box, click the Connection tab.

      Note In Visual Studio 2005, click Add Connection.
    5. In the Select or enter a server name box, type Database Server Address.

      Note Database Server Address is a placeholder for the address of the computer that contains the MyDatabase database in SQL Server 2000.
    6. In the User name box, type YourUserName.

      Note YourUserName is a placeholder for the user name that you use to log on to SQL Server 2000. This user name authenticates your connection to the database server.
    7. In the Password box, type YourPassword.

      Note YourPassword is a placeholder for the password that you use to connect to the database server.
    8. Select the Allow saving password check box.
    9. In the Select the database on the server box, select MyDatabase, and then click OK.
    10. Expand MyDatabase, and then expand Tables.
    11. Right-click MyTable, and then click Retrieve Data from Table.
Notice that the first two columns of the Results pane appear to be empty. The data type of the first column is CHAR and the data type of the second column is NCHAR. Each of these columns has a field size of 1000 characters. The first two columns of the Results pane will always appear to be empty, regardless of the data that the columns contain.

The data type of the third column is VARCHAR and the data type and the fourth column is NVARCHAR. Notice that the third column and the fourth column of the first row in the Results pane contain data. The data in the third column and in the fourth column of the first row have 900 characters.

Notice that the third column and the fourth column of the second row in the Results pane do not contain any data. The data in the third column and in the fourth column of the second row have 901 characters.

Therefore, a column that has a data type of CHAR, VARCHAR, NCHAR, or NVARCHAR, and that has more than 900 characters, does not appear in the Results pane in Visual Studio .NET or in Visual Studio 2005.

Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbTSQL kbtable kbcode kbSqlClient kbtshoot kbbug KB884464 kbAudDeveloper