derived CRecordset field binding problem?
Posted on 2008-10-30
I have a view called 'view_worklist' defined in MS SQL server that produces output columns of the following types:
int, uniqueidentifier, nvarchar(255), nvarchar(max), datetime, xml
In Visual C++ 6.0 class wizard, I created CWorklistRS derived from CRecordset. I chose to bind all the columns and the wizard did its thing. I then changed the member type from CString to CByteArray for each of the uniqueidentifier columns and replaced the RFX_Text macro with RFX_Binary for the same.
I then implemented GetDefaultSQL to return "select * from view_worklist where id=1"
Connection to the server works properly. I create an instance of CWorklistRS as follows:
if( rsWorklist.Open( CRecordset::snapshot ))
however I end up getting an exception in:
LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
The exception reads "Restricted data type attribute violation"
State:07006,Native:0,Origin:[Microsoft][SQL Native Client]
m_nRetCode = -1
Any ideas what I'm doing wrong? Is it perhaps because the data source is a view and not a table? If so how do I handle that?