Microsoft
Software
Hardware
Network
Question : Why is appendOnly CRecordset readOnly
Hello,
I have an MFC application that connects to an Access DB using ODBC. I use the MFC ODBC interface. Everything was working great, until I switched the option for _MBCS to _UNICODE (with appropriate code changes). Now I get an exception as I try to save to the database because "RecordSet read-only." Is there some problem with ODBC and Unicode? What could be the cause of this change of heart?
Here is my code:
// open the recordset
rs.Open(CRecordset::snapsh
ot, rs.GetDefaultSQL(), CRecordset::appendOnly);
// added to test. I always get the message.
if (!rs.CanAppend()) ::AfxMessageBox(_T("I can not append to this."));
Again, before, when my App was using MBCS, there were no problems at all. The only code I changed in order to get it to compile under UNICODE.
Thanks,
Adeh
Answer : Why is appendOnly CRecordset readOnly
hm ... I'm not sure (since I'm not very experienced with DB-stuff),
but I think the problem is caused by not running 'cursor library'.
In MSDN article Q140598 I found:
>...
>A snapshot recordset relies on the cursor library for
>additions or updates to the database. If the cursor library
>is not loaded, the recordset becomes read-only and does not
>allow additions or updates.
>...
About why cursor library load fails I only found article Q259477
where I found:
>...
>To avoid this problem, do not use ODBC cursors in a
>Unicode environment.
>...
So, as told above I'm no DB-guru, but if the info is correct
I found in MSDN I would read it as 'snapshot recodesets cannot
be used with UNICODE' ...
but maybe I'm wrong ;o)
ZOPPO
Random Solutions
active directory, W2k8 R2 DC, Kerberos failures, Event ID: 3, 4771, 4769, 4768, 4776, 4625 source: Microsoft Windows security
Problem with "like" keyword, when database is in chinese
video card driver
Pass Web Page as Parameter to Class in App_Code Folder
How to create a non-scrolling section (menu) of a web page
Basic steps for a Zip code search ASP.NET VB, MS SQL 2008
SQL Count Query In a Main Query
CLR Stored Procedure
Compaq Presario SR5010NX Desktop PC
How do you check the current date format of an SQL Server 2005 database?