MFC, CRecordset::PrepareAndExecute() Error using MSSQL-Sever-2005
Posted on 2010-08-15
I connect to an MSSQL DB 2005
Connection to DSN used in CDatabase Tested Ok.
Before I insert rec to the DB table I open the a CRecordset with
CRecordset::Open(nOpenType, ssQueryStr, dwOptions);
nOpenType = CRecordset::dynaset
ssQueryStr = select * from mytable where 1 = 0 // returns no records
dwOptions = 0
(with plan to call AddNew() and Update() later)
But this throws exception in CRecordset::PrepareAndExecute() at
// now attempt to execute the SQL Query if not executed already
if (!(m_dwOptions & executeDirect))
This had worked before.
Please any suggestion to the cause, solution or workarround to this problem?