# Web Development > ASP.NET ODP.NET - Populating a Dataset with Multiple Data Tables

## admin

ODP.NET - Populating a Dataset with Multiple Data TablesNow, let us add more than one data table into a dataset The following code retrieves a list of department details into a data table named Departments and another list of employee details into a data table named Employees: 

More...

----------


## nippu_m

Hi,
The following code will set the two tables in one dataset.

//Create a SqlConnection and SqlDataAdapter object
            string ConnectionString = @"User ID=sa;Initial Catalog=TimeSheet;Data Source=local;";
            SqlConnection con = new SqlConnection(ConnectionString);
            SqlDataAdapter da1 = new SqlDataAdapter("SELECT * FROM Departments",con);
            //Create a dataset to store the Project Info data.
            DataSet ds1 = new DataSet();
            da1.Fill(ds1, "Departments"); 
            DGrdRegTime.DataSource = ds1.Tables["Departments"];

            SqlDataAdapter da2 = new SqlDataAdapter("SELECT * FROM Emp",con);
            DataSet ds2 = new DataSet();
            da2.Fill(ds2, "Emp");
            DGrdRegTime.DataSource = ds2.Tables["Emp"];
 ds1.Merge(ds2);

----------


## peeyush_jain

nice example  :Smile:  thanks to guide such a simple and clear example

----------

