Parameters
- values
- An array of System.Object into which to copy the attribute column values.
Return Value
The number of instances of System.Object in the array.
You can pass an System.Object array that contains fewer than the number of column values contained in the resulting row. Only the amount of data the System.Object array holds is copied to the array. You can also pass an System.Object array whose length is more than the number of columns contained in the resulting row.
This method returns System.DBNull for redundant array elements.
public void GetObjects(PgSqlConnection pgConnection) { PgSqlCommand cmd = new PgSqlCommand("SELECT * FROM Test.Emp"); cmd.Connection = pgConnection; pgConnection.Open(); try { PgSqlDataReader reader = cmd.ExecuteReader(); reader.Read(); object[] objs = new object[3]; int quant = reader.GetValues(objs); for (int i=0;i < quant;i++) { Console.WriteLine(objs[i]); } reader.Close(); } finally { pgConnection.Close(); } }
Public Sub GetObjects(ByVal pgConnection As PgSqlConnection) Dim cmd As PgSqlCommand = New PgSqlCommand("SELECT * FROM Test.Dept") cmd.Connection = pgConnection pgConnection.Open() Try Dim reader As PgSqlDataReader = cmd.ExecuteReader() reader.Read() Dim objs(3) As Object Dim quant As Integer = reader.GetValues(objs) Dim i As Integer For i = 0 To quant - 1 Console.WriteLine(objs(i)) Next i reader.Close() Finally pgConnection.Close() End Try End Sub
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