FetchAll Property (PgSqlCommand)
Gets or sets a value indicating whether the
PgSqlDataReader object will request data from the server on execution
ExecuteReader method.
public bool FetchAll {get; set;}
'Declaration
Public Property FetchAll As Boolean
Property Value
true, if the
PgSqlDataReader object will request data from the server on execution
ExecuteReader; otherwise
false. The default value is
true.
The following example fills two ListBox by data from the
PgSqlDataReader. This sample demonstrates ability to navigate through the
PgSqlDataReader several times when
FetchAll property set to
true.
public void FillListBox()
{
PgSqlCommand cmd;
PgSqlDataReader reader;
ListBox deptnoList, nameList;
cmd = new PgSqlCommand("select deptno, dname from dept");
cmd.FetchAll = true;
reader = cmd.ExecuteReader();
foreach (IDataRecord rec in reader) {
deptnoList.Items.Add(rec["deptno"]);
}
foreach (IDataRecord rec in reader) {
nameList.Items.Add(rec["dname"]);
}
}
Public Sub FillListBox()
Dim cmd As PgSqlCommand
Dim reader As PgSqlDataReader
Dim deptnoList As ListBox
Dim nameList As ListBox
cmd = New PgSqlCommand("select deptno, dname from dept")
cmd.FetchAll = True
reader = cmd.ExecuteReader()
Dim rec As IDataRecord
For Each rec In reader
deptnoList.Items.Add(rec("deptno"))
Next
For Each rec In reader
nameList.Items.Add(rec("dname"))
Next
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