I suggest you use ODBC, this way it doesn't matter what DB system is on the receiving end of your commands
If you use VC/MFC, use the CDatabase/CRecordset classes.
As communication with any DB system includes SQL, t might help to print out the neccessary SQL statements first and testing them with test data by hand on your DB system. Then implement them with the given classes.
db.Open( "USR=scott;PWD=tiger;DSN=test" );
int field_x = 3445;
strSQL.Format( "SELECT * FROM TABLE_X WHERE FIELD_X = %d", field_x );
rs.Open( CRecordset::forwardOnly, strSQL );
while( ! rs.IsEOF() )
rs.GetFieldValue( (short)0, strField );
//do smth with field
catch( CException* e )
// do smth with e