Executes the specified SQL-statement and returns DataSet.
Namespace: Nemiro.Data.SqlAssembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
public DataSet GetData(
string sql
)
public DataSet GetData(
string sql
)
Public Function GetData (
sql As String
) As DataSet
Public Function GetData (
sql As String
) As DataSet
Parameters
- sql
- Type: System String
Query SQL, to be executed.
Return Value
Type:
DataSetException | Condition |
---|
SqlException | The exception that is thrown when SQL Server returns a warning or error. |
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"]);
}
}
}
}
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"]);
}
}
}
}
Using c As new SqlClient()
Dim data As DataSet = c.GetData("SELECT * FROM messages; SELECT * FROM users;")
If data.Tables.Count > 0 Then
For Each t As DataTable In data.Tables
For Each r As DataRow In table.Rows
Console.WriteLine("id = {0}", r("id"))
Next
Next
End If
End Using
Using c As new SqlClient()
Dim data As DataSet = c.GetData("SELECT * FROM messages; SELECT * FROM users;")
If data.Tables.Count > 0 Then
For Each t As DataTable In data.Tables
For Each r As DataRow In table.Rows
Console.WriteLine("id = {0}", r("id"))
Next
Next
End If
End Using