SELECT command for the connection.SELECT statement. Data is returned using a record source. Record sources are discussed in Chapter 4.
{
TSQLStandardDBProtocolSQLNet15 sqlNet;
TSQLStandardDataStoreOracle7 oracle7;
TSQLStandardConnectionHandle dbc(sqlNet, oracle7);
dbc.LogonStep(1, TSQLLogonStep(
TStandardText("t:129.213.80.90:SAMP"),
TStandardText("auser"), TStandardText("apassword")));
TSQLCommandHandle selectCmd =
dbc.CreateSQLCommand(TStandardText(
"SELECT EMPNO, PROJECTNAME FROM Project"));
selectCmd.Execute();
TRecordSourceHandle recSrc = selectCmd.GetRecordSource();
cout << "EMPNO" << "," << "PROJECTNAME" << endl;
while (recSrc.FetchRecord())
{
long empNo;
TStandardText projName;
Boolean avail;
avail = recSrc.GetField(empNo, 1);
avail = recSrc.GetField(projName, 2);
cout << empNo << "," << projName << endl;
}
}