'Declaration Public Overrides Function ExecuteScalar() As Object
public override object ExecuteScalar()
Return Value
The first column of the first row in the result set.
'Declaration Public Overrides Function ExecuteScalar() As Object
public override object ExecuteScalar()
using(PgSqlConnection conn = new PgSqlConnection(connectionString)) { conn.Open(); PgSqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT count(*) as NumberOfRegions FROM regions"; Int64 count = Convert.ToInt64(cmd.ExecuteScalar()); }
Dim conn As New PgSqlConnection(connectionString) conn.Open() Dim cmd As PgSqlCommand = conn.CreateCommand() cmd.CommandText = "SELECT count(*) as NumberOfRegions FROM regions" Dim count As Int64 = Convert.ToInt64(cmd.ExecuteScalar()); conn.Close()
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2