I have a class, CBVRecordSet, derived from CDaoRecordset. This class was
created from a table in an Access database. The table has these fields:
Basis Vector ID
Atom Name
Base Material Name
x
y
z
Now, when I try to open a recordset with the following statements:
CString sqlStatement;
sqlStatement.Format ("SELECT DISTINCT [Atom Name] FROM [BasisVector] "
"WHERE [Base Material Name] = \'%s\' ORDER BY [Atom Name]", bmName);
BasisVectorRecordSet bvRc;
bvRc.Open (dbOpenDynaset, LPCTSTR (sqlStatement));
I get an error stating "GetRows failed. The requested column is not a member
of this recordset."
What is really funny is if I use the same SQL statement in a query in
Access, substituting a valid bmName, the query completes correctly, without
any error.
I suspect that there is something specifically wrong in my syntax. The
reason I say this is because if I change the syntax to:
"SELECT * FROM [BasisVector] WHERE [Base Material Name] = \'%s\' ORDER BY
[Atom Name]"
I don't get the error message.
Does anyone know what is going on here? What am I doing wrong? Thanks in
advance for any suggestions.
Don Thomas