SqlClient GetTable Method (SqlCommand)Nemiro.Data.dll
Executes the specified SqlCommand and returns DataTable.

Namespace: Nemiro.Data.Sql
Assembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
Syntax

public DataTable GetTable(
	SqlCommand cmd
)

Parameters

cmd
Type: System.Data.SqlClient SqlCommand
Instance SqlCommand, containing the query and the query parameters.

Return Value

Type: DataTable
Exceptions

ExceptionCondition
SqlExceptionThe exception that is thrown when SQL Server returns a warning or error.
Examples

using (SqlClient c = new SqlClient())
{
  SqlCommand cmd = new SqlCommand("SELECT * FROM users;");
  DataTable table = c.GetTable(cmd);
  foreach(DataRow row in table.Rows)
  {
    Console.WriteLine("login = {0}", row["login"]);
  }
}
See Also