Executes the query and returns data row.
Namespace: Nemiro.Data.SqlAssembly: Nemiro.Data (in Nemiro.Data.dll) Version: 2.11.4.126 (2.11.4.126)
public DataRow GetRow(
string sql
)
public DataRow GetRow(
string sql
)
Public Function GetRow (
sql As String
) As DataRow
Public Function GetRow (
sql As String
) As DataRow
Parameters
- sql
- Type: System String
Query SQL, to be executed.
Return Value
Type:
DataRowException | Condition |
---|
SqlException | The exception that is thrown when SQL Server returns a warning or error. |
using (SqlClient c = new SqlClient())
{
DataRow row = c.GetRow("SELECT * FROM users WHERE login = 'anylogin';");
if(row != null)
{
Console.WriteLine("nickname = {0}", row["nickname"]);
}
}
using (SqlClient c = new SqlClient())
{
DataRow row = c.GetRow("SELECT * FROM users WHERE login = 'anylogin';");
if(row != null)
{
Console.WriteLine("nickname = {0}", row["nickname"]);
}
}
Using c As new SqlClient()
Dim row As DataRow = c.GetRow()
If row IsNot Nothing Then
Console.WriteLine("nickname = {0}", row("nickname"))
End If
End Using
Using c As new SqlClient()
Dim row As DataRow = c.GetRow("SELECT * FROM users WHERE login = 'anylogin';")
If row IsNot Nothing Then
Console.WriteLine("nickname = {0}", row("nickname"))
End If
End Using