Generate class from stored procedure C#
I have few sql procedures returns lot of tables. I want a way to automatically generate classes for procedure tables output. Every table should generate a class.How can i achieve this ?
Thanks
Anil
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add("Id", typeof(int));
dt.Columns[0].AutoIncrementSeed = 1;
dt.Columns[0].AutoIncrement = true;
dt.Columns.Add("Name");
dt.Columns.Add("Employer");
dr = dt.NewRow();
dr["Name"] = "DNS";
dr["Employer"] = "ASP.NET";
dt.Rows.Add(dr);
DataTable dt2 = new DataTable();
DataRow dr1 = null;
dt2.Columns.Add("Id", typeof(int));
dt2.Columns[0].AutoIncrementSeed = 1;
dt2.Columns[0].AutoIncrement = true;
dt2.Columns.Add("Name");
dt2.Columns.Add("Employer");
dr1 = dt2.NewRow();
dr1["Name"] = "Kumar";
dr1["Employer"] = "Dotnet Developer";
dt2.Rows.Add(dr1);
dt2.Merge(dt);
dt2.AcceptChanges();