Database.Connection con = Database.Connection("DBConnector1");
con.connect();
Database.ResultSet result = con.query("SELECT * FROM customers");
while (result.fetchNext()) {
string firstName = result["FirstName"];
string lastName = result["LastName"];
for (int j = 1; j <= result.numFields; j++) {
Variant column1Value = result[j];
...
}
...
}
con.disconnect();
A Database.ResultSet implements a forward-only cursor. This means you can only traverse through the results once.
This can either be done manually, using fetchNext(), or automatically
by dumping the data to a table with cloneTo(). However, you cannot do
both. In other words, you cannot clone the result using cloneTo(), and then also use fetchNext() to traverse the result again,
or vice versa.
Database.Connection con = Database.Connection("DBConnector1");
con.connect();
con.query("SELECT * FROM customers").cloneTo(Table("Customers"));
con.disconnect();
Do no remove, this fixes the anchor on doc.flexsim.com