1.
CDatabase aDatabase;
aDatabase.OpenEx(strOdbcConnect,CDatabase::noOdbcDialog); CString strSQL;
strSQL.Format("Delete table1 where attr='%s'", varattr);
aDatabase.ExecuteSQL(strSQL);2.
CDatabase db;
db.OpenEx(strOdbcConnect,CDatabase::noOdbcDialog); CString strSQL;
strSQL.Format("select * from table1 where attr='%s'", varattr);
// strSQL.Format("select col1,col2 from table1 where attr='%s'", varattr); CRecordset rs(&db);
rs.Open(CRecordset::snapshot,strSQL, CRecordset::readOnly); while( !rs.IsEOF() )
{
CString str1, str2;
rs.GetFieldValue(1,str1);
rs.GetFieldValue(2,str2); // rs.GetFieldValue("col1",str1);
// rs.GetFieldValue("col2",str2); rs.MoveNext();
} rs.Close();
db.Close();