C# read a DataTable

Date: 2021-03-22
public async Task<DataTable> ReadTable(SqlConnection conn, string query)
{
	using var cmd = conn.CreateCommand();
	cmd.CommandText = query;
	var table = new DataTable();
	table.BeginLoadData();
	table.Load(await cmd.ExecuteReaderAsync());
	table.EndLoadData();
	return table;
}
47290cookie-checkC# read a DataTable