how to get IEnumerable into a dataset

Johann Montfort posted at 03-Jul-08 06:11

Hi All,

I am trying to get the result of an IEnumerable function into a dataset, and until now, without any success.

Here is what I have done so far:-

In my DAL

public static IEnumerable<DALLINQ.projects_getAllActiveProjectsResult> GetAllActiveProjects()

{

using (var db = new DALLINQ.DataContext())

{

return db.projects_getAllActiveProjects();

}

}

Then in my code:-

public DataSet getprojects()

{

DataSet ds = new DataSet();

DataTable dt = new DataTable();

foreach (var result in projects.GetAllActiveProjects())

{

dt.Rows.Add(new object[] { result.projectId, result.projectName, result.url });

}

ds.Tables.Add(dt);

return ds;

}

However this is not working

Any help very much appreciated!

Thanks


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  how to get IEnumerable into a dataset - Johann Montfort  03-Jul-08 06:11 6:11:12 AM
      Check these links - santhosh kumar  03-Jul-08 06:43 6:43:44 AM
          Page Not Found - Johann Montfort  03-Jul-08 06:50 6:50:44 AM
      Solution to dataset ienumerable - Umapathy Kaliaperumal  03-Jul-08 06:56 6:56:30 AM
          ilistsource - Johann Montfort  03-Jul-08 07:09 7:09:09 AM
              sol - Umapathy Kaliaperumal  03-Jul-08 11:19 11:19:50 AM
                  thanks - Johann Montfort  03-Jul-08 11:26 11:26:18 AM
      Replly - alice johnson  03-Jul-08 01:30 1:30:16 PM
      See here: - Peter Bromberg  03-Jul-08 03:42 3:42:14 PM
          Amended post to Peter - Johann Montfort  04-Jul-08 04:04 4:04:54 AM
View Posts