FIX: "Cannot resolve collation conflict for column 2 in SELECT statement" error message when you expand or drag a table (325681)



The information in this article applies to:

  • Microsoft ADO.NET (included with the .NET Framework)
  • 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
  • Microsoft ADO.NET (included with the .NET Framework 1.1)
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition

This article was previously published under Q325681

SYMPTOMS

In Visual Studio .NET Server Explorer, a connection is established to a Microsoft SQL Server database. When you expand a table to view fields, or when you drag a table to the Form Designer, you may receive the following error message:
ADO error: Cannot resolve collation conflict for column 2 in SELECT statement.

CAUSE

The Visual Database Tool does not work correctly when you set the SQL Server database collation property to a collation setting that is different from the server default collation.

RESOLUTION

To work around this problem, use one of the following methods:
  • Create a new database with the collation name as "(server default)". Import data from the current database, and make sure that the Copy objects and data between SQL Server databases option is selected. Connect to this new database from Server Explorer.
  • Do not use Server Explorer to drag the table to the Form Designer so that ADO.NET generates the code for you. Instead, create the SqlDataAdapter object and its UpdateCommand, DeleteCommand, and InsertCommand properties programmatically in the code.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Use SQL Server Enterprise Manager to open an instance of Microsoft SQL Server.
  2. Create a new database named TestDB, and then select any collation name other than the server default for the database.
  3. Create a table named Table1 in the TestDB database, add the following columns to Table1, and then set column "c1" as the primary key:
    Column NameData TypeLengthAllow NullCollation
    c1char10NOT NULLdatabase default
    c2char10NULLdatabase default

  4. Start Visual Studio .NET.
  5. In Server Explorer, add a new data connection to this instance of SQL Server and the TestDB database.
  6. Expand the Tables and the Table1 nodes. Notice that you receive the following error message:
    ADO error: Cannot resolve collation conflict for column 2 in SELECT statement.
  7. Drag Table1 to Form Designer. Notice that you receive a Data Adapter Configuration Error dialog box that includes the following error messages:
    Generated INSERT statement.
    ADO error: Cannot resolve collation conflict for column 2 in SELECT statement.

    Generated UPDATE statement.
    ADO error: Cannot resolve collation conflict for column 2 in SELECT statement.

    Generated DELETE statement.
    ADO error: Cannot resolve collation conflict for column 2 in SELECT statement.

Modification Type:MinorLast Reviewed:9/15/2005
Keywords:kbvs2002sp1sweep kbbug kbpending KB325681 kbAudDeveloper