Executes the query and returns DataTable.
This method is used in conjunction with the properties CommandType, CommandText and Parameters.
Namespace: Nemiro.Data.SqlAssembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
Syntax
Return Value
Type: DataTableExceptions
Exception | Condition |
---|---|
SqlException | The exception that is thrown when SQL Server returns a warning or error. |
Examples
using (SqlClient c = new SqlClient()) { c.CommandText = "SELECT * FROM users;"; DataTable table = c.GetTable(); foreach(DataRow row in table.Rows) { Console.WriteLine("login = {0}", row["login"]); } }
See Also