2
Answers

Select query for retrieve data from temporary DataTable?

Mani Kandan

Mani Kandan

8y
278
1
Sir,
 
How can I write this inline sql (That is,cmdstr) query to datarow c#?
 
string cmdstr = "select top 5 First_name, COUNT(Department) [Department] from Employee group by First_name"; 
 
 DataTable dt = new DataTable("Employee");
dt.Columns.Add(new DataColumn("Id", typeof(int)));
dt.Columns.Add(new DataColumn("First_name", typeof(string)));
dt.Columns.Add(new DataColumn("Department", typeof(int)));

dt.Rows.Add(1, "Jerry", 1);
dt.Rows.Add(2, "Mudassar", 1);
dt.Rows.Add(3, "Mathews", 1);
dt.Rows.Add(4, "Robert", 1);
dt.Rows.Add(5, "John", 1);
 
 
DataRow[] result =?

Answers (2)