Executes the specified SqlCommand and returns строку данных.
Namespace: Nemiro.Data.SqlAssembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
public DataRow GetRow(
SqlCommand cmd
)
public DataRow GetRow(
SqlCommand cmd
)
Public Function GetRow (
cmd As SqlCommand
) As DataRow
Public Function GetRow (
cmd As SqlCommand
) As DataRow
Parameters
- cmd
- Type: System.Data.SqlClient SqlCommand
Instance SqlCommand, containing the query and the query parameters.
Return Value
Type:
DataRowException | Condition |
---|
SqlException | The exception that is thrown when SQL Server returns a warning or error. |
using (SqlClient c = new SqlClient())
{
SqlCommand cmd = new SqlCommand("SELECT * FROM users WHERE login = 'anylogin';");
DataRow row = c.GetRow(cmd);
if(row != null)
{
Console.WriteLine("nickname = {0}", row["nickname"]);
}
}
using (SqlClient c = new SqlClient())
{
SqlCommand cmd = new SqlCommand("SELECT * FROM users WHERE login = 'anylogin';");
DataRow row = c.GetRow(cmd);
if(row != null)
{
Console.WriteLine("nickname = {0}", row["nickname"]);
}
}
Dim cmd As New SqlCommand()
Dim row As DataRow = c.GetRow(cmd)
If row IsNot Nothing Then
Console.WriteLine("nickname = {0}", row("nickname"))
End If
End Using
Dim cmd As New SqlCommand("SELECT * FROM users WHERE login = 'anylogin';")
Dim row As DataRow = c.GetRow(cmd)
If row IsNot Nothing Then
Console.WriteLine("nickname = {0}", row("nickname"))
End If
End Using