Data Sources Window and Data Binding  
Author Message
Roger Sutter





PostPosted: .NET Framework Data Access and Storage, Data Sources Window and Data Binding Top

I have a question about data binding that someone may have an answer for.

I'm going through "Walkthrough: Connecting to Data in a Database".  I'm using Visual Studio 2005 and SQL Server Express 2005.  I've loaded the Northwind tables etc. in SQL Server Express.

The first time through this walkthrough, I created a new Windows Application project.  I opened the Data Sources window and "added a new data source".  I selected the Customers and Orders tables and let it create the dataset in my project.   I opened Form1, returned to my Data Sources window, and drug a few Customers fields and the Orders datagridview on to Form1.  Visual Studio then created the northwindDataSet, the customersBindingNavigator, the customerBindingSource,  the customersTableAdapter, the ordersBindingSource and the ordersTableAdapter in the component tray.  The last thing I had to do was run the application and everything worked as expected!  I could navigate the customers and the orders table would be kept in synchronization.

That was fantastic except standards suggest that I should have my data access (the dataset) in a separate project within the solution.  So I created a new solution with a Windows Application project and a Class Library project.  In the Class Library project, I created a new data source and generated the Customers and Orders dataset exactly as I had in the first example.  I then went to my Windows Application project and opened Form1.  I then opened the data sources window and discovered that it doesn't know anything about the Data Source and Dataset created in the Class Library.

How do I fix that   I added a reference in the Windows Application that selects my Class Library project but still no luck.

Anybody have any suggestions   Thanks in advance.



.NET Development24