SqlClient GetData Method (String)Nemiro.Data.dll
Executes the specified SQL-statement and returns DataSet.

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

public DataSet GetData(
	string sql
)

Parameters

sql
Type: System String
Query SQL, to be executed.

Return Value

Type: DataSet
Exceptions

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

using (SqlClient c = new SqlClient())
{
  DataSet data = c.GetData("SELECT * FROM messages; SELECT * FROM users;");
  if(data.Tables.Count > 0)
  {
    foreach(DataTable t in data.Tables)
    {
      foreach(DataRow r in table.Rows)
      {
        Console.WriteLine("id = {0}", r["id"]);
      }
    }
  }
}
See Also