// Test1.cpp
#include "EmpRecSet.h"
#include <iostream.h>
#include <fstream.h>
main()
{
// Connect to Database:
CDatabase db;
db.Open(0,FALSE,TRUE,
"ODBC;DSN=North Wind");
// Define/populate recordset:
EmpRecSet e(&db);
e.m_strFilter = "[Employee ID] > 5";
e.Open();
// Print data:
ofstream outf("Employee1.out",
ios::trunc | ios::out);
while (!e.IsEOF())
{
outf << '{' << e.m_Employee_ID
<< ',' << e.m_Last_Name
<< ',' << e.m_First_Name
<< ',' << e.m_Home_Phone
<< ',' << e.m_Reports_To
<< '}' << endl;
e.MoveNext();
}
return 0;
}
/* Output:
{6,Suyama,Michael,(71) 555-7773,5}
{7,King,Jonathan,(71) 555-5598,5}
{8,Callahan,Linda,(206) 555-1189,2}
{9,Dodsworth,Annabella,(71) 555-4444,5}
*/
//End of File