Here is some thing I do in my project. In the below example I am getting dataset from different tables User and Roles. One my stored procedure is executed and I have my dataset I am using
ds.Tables[0].AsEnumerable()
- to get the data from data table in to userinfo. Further I am using
ds.Tables[1].AsEnumerable()
to get access to the second table in the dataset. You can try to do in your case as well.
DataSet ds = dm.ExecuteQuery("SpGetUserDetails", parameters);
User userInfo = (from r in ds.Tables[0].AsEnumerable()
select new User
{
FullName = r["FirstName"].ToString() + " " + r["LastName"].ToString(),
FirstName = r["FirstName"].ToString(),
MiddleName = r["MiddleName"].ToString(),
LastName = r["LastName"].ToString(),
EmailId = r["EmailId"].ToString()
}).SingleOrDefault();
userInfo.Roles =(from r in ds.Tables[1].AsEnumerable()
select new UserRoles
{
UserRoleMappingId = Convert.ToInt32(r["UserRoleMappingId"].ToString()),
UserRoleId = Convert.ToInt32(r["UserRoleId"].ToString()),
UserId = Convert.ToInt32(r["UserId"].ToString()),
RoleName = r["RoleDescription"].ToString()
}).ToList();
Hope this helps.
Happy Learning