Fill a Typed Dataset from a Stored Procedure that returns Multiple Result sets
This tip explains how to populate a Typed Dataset from a Stored Procedure, which returns multiple result sets. We need to use the DataAdapter TableMappings collection to map the generic t
May 19, 2004
This tip explains how to populate a Typed Dataset from a Stored Procedure, which returns multiple result sets.
We need to use the DataAdapter TableMappings collection to map the generic tables to the schema, which is defined in the typed Dataset. When the Data Adapter is used to fill a dataset, the dataset is filled with tables named as Table, Table1, Table2 and so on. So typed Datasets can’t be populated normally.
The Stored Procedure
Shown above is the Stored Procedure, which will be used to populate two tables in the Typed Dataset given below.
Employees
Departments
The Typed Dataset
Create a Typed Dataset by dragging and dropping the two tables from the Server Explorer in Design Mode.
Code
The following piece of code will help us to populate a typed Dataset directly with the Fill method of the Data Adapter.
<span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'"> <br><br><br></span>
Hope this is useful. Happy Coding!!!!
<span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'"> <br><br><br></span>
About the Author
You May Also Like