Use the DataTable.Load method to fill your table with values from the SqlDataReader:
using (SqlDataReader dr = command.ExecuteReader())
{
var tb = new DataTable();
tb.Load(dr);
return tb;
}
More Related Contents:
- LINQ query on a DataTable
- How to read a CSV file into a .NET Datatable
- Creating a DateTime in a specific Time Zone in c#
- How can I convert an integer into its verbal representation?
- Best way to remove duplicate entries from a data table
- How to change the color of progressbar in C# .NET 3.5?
- How to parse a string into a nullable int
- How to select min and max values of a column in a datatable?
- Don’t stop debugger at THAT exception when it’s thrown and caught
- How to compare 2 dataTables
- Inconsistency in divide-by-zero behavior between different value types
- Software rendering mode – WPF
- Convert DataTable to generic List?
- What is the Efficiency and Performance of LINQ and Lambda Expression in .Net?
- Operation could destabilize the runtime?
- Monitoring Garbage Collector in C#
- How do I get the Local Network IP address of a computer programmatically?
- How can I join int[] to a character-separated string in .NET?
- DataTable equivalent in Java [duplicate]
- Dependency Injection wcf
- Put WPF control into a Windows Forms Form?
- Best way to check if a Data Table has a null value in it
- Get Cell Value from a DataTable in C#
- Returning DataTables in WCF/.NET
- Finding all classes with a particular attribute
- How to convert DataTable to class Object?
- DataTable internal index is corrupted
- How can I convert a DataTable to an XML file in C#?
- Get first element from a dictionary
- How to check if process is not responding?