Search code examples
c#sql-servervisual-studio-2017sql-viewstrongly-typed-dataset

SQL Server View in typed DataSet


I created a view in the database in SQL Server Management Studio. The view is based on two tables, connected with an inner join. In Visual Studio I have an application with a typed dataset, I created a class view that contains fields the same as a view from database. What is troubling me is that I do not know how to fill the view object, because I want to create a list from it that I will display in the datagrid.

Do I need to create new table adapter or something else? I hope I explained well :)


Solution

  • Use the steps given in the screenshot to add a new Dataset to your project:

    Adding Dataset to project

    After that follow the wizard to add your desired Tables/Views to the dataset - and create methods for how to get data into this dataset from DB.