1.1.1

Table Of Contents
SQLFDataReader reader = command.ExecuteReader();
StringBuilder row = new StringBuilder();
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
row.AppendFormat("{0}, ", reader.GetString(i));
Console.WriteLine(row.ToString());
}
}
catch (Exception e)
{
///
/// Log or re-throw exception
///
}
finally
{
connection.Close();
}
Storing a Table
You can use SQLFDataAdapter to populate a System.Data.DataTable object with the results from a SQL
command, or to refresh a DataTable object with new results.
The following example lls a DataTable with rows retrieved from a table, and then uses the DataTable to display
each row.
string sqlfHost = "localhost";
int sqlfPort = 1527;
string connectionStr = string.Format(@"server={0}:{1}", sqlfHost, sqlfPort);
SQLFClientConnection connection = null;
try
{
connection = new SQLFClientConnection(connectionStr);
SQLFCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
command.CommandText = "SELECT * FROM product";
connection.Open();
// Create adapter and populate the DataTable object
SQLFDataAdapter adapter = command.CreateDataAdapter();
DataTable table = new DataTable("product");
adapter.Fill(table);
// Parse the DataTable object by rows
foreach (DataRow row in table.Rows)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < row.Table.Columns.Count; i++)
sb.AppendFormat("{0}, ", (row[i].ToString()));
Console.WriteLine(sb.ToString());
vFabric SQLFire User's Guide136
Developing Applications with SQLFire