"Connection string is invalid" error message when you preview data or generate a dataset control (815119)



The information in this article applies to:

  • Microsoft ADO.NET (included with the .NET Framework 1.1)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual Basic .NET (2003)

SYMPTOMS

If more than one connection exists in Microsoft Visual Studio .NET Server Explorer, and if you cannot see Server Explorer in Visual Studio .NET, you may receive the following error message when you click Fill Dataset to preview the data in the Data Adapter Preview window:
SqlDataAdapterName. The data adapter could not return the data from the data source.

The connection string is invalid.
Alternatively, when you right-click DataAdapter and then click Generate Dataset, you may receive the following error message:
Retrieving the schema for SqlDataAdapter1 failed.

The connection string is invalid.

CAUSE

Connection Manager manages the Microsoft SQL Server connections in Visual Studio .NET. When you click Fill Dataset or Generate Dataset, a Connection object is built and then added to the Connection Manager list of Connection objects. Connection Manager finds the Connection in its list and then prepares to return the Connection with the display name of the Connection. To return the display name, Connection Manager incorrectly opens Server Explorer and then looks for a connection in Server Explorer. Connection Manager generates an error because the connection does not exist in Server Explorer.

RESOLUTION

You can safely ignore this error message and then click Fill Dataset or Generate Dataset a second time. Alternatively, you can open Server Explorer before you click Fill Dataset or Generate Dataset.

To open Server Explorer, click Server Explorer on the View menu in Visual Studio .NET.

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. Start Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.
  3. Click Visual Basic Projects or Visual C# Projects under Project Type, and then click Windows Application under Templates.
  4. On the View menu, click Server Explorer.
  5. In Server Explorer, right-click Data Connections, and then click Add Connection.
  6. Type the name of the server that is running Microsoft SQL Server in the Select or enter a server name text box. Type your SQL Server user name and your SQL Server password in the User name and Password text boxes respectively, and then click Northwind in the Select the database on the server list.
  7. Repeat steps 4 and 5 to create a connection to the pubs database.
  8. In Server Explorer, drag the Customers table of the Northwind database to the form.
  9. Save the project, and then close Server Explorer.
  10. Close the Visual Studio .NET IDE.
  11. Open the project again. Right-click SqlDataAdapter1, and then click Preview Data.
  12. In the Data Adapter Preview dialog box, click Fill Dataset.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MinorLast Reviewed:3/9/2006
Keywords:kbDragDrop kbDataview kbDatabase kbDataAdapter kbSystemData kberrmsg kbbug KB815119 kbAudDeveloper