GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 23-Jul-2007, 03:37
danny77uk danny77uk is offline
New Member
 
Join Date: Jul 2007
Posts: 2
danny77uk is on a distinguished road

CRecordset is read-only when set to snapshot???


Hi guys. I'm having a problem with CRecordset. Everything works (read, update, append) fine when I use the 'dynaset' option but I need to use the static option. But if I set the class to use that type in it's construtor, I always get an error that the database is read-only when trying to edit or add records which is rubbish.

I've traced the code and both the database (SQL Server) and CDatabase object are NOT readonly. It's just that the recordset always is when set to snapshot. According to MSDN, both dynaset and snapshot recordsets can be written to so I don't get what I'm doing wrong.

You can reproduce this behaviour using the wizard - create an SDI app with an ODBC database and try to add or edit records.

Am I missing something?
  #2  
Old 23-Jul-2007, 21:02
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,006
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: CRecordset is read-only when set to snapshot???


I'll have to double check the SDI-ODBC thing, but I generally regard snapshots like a view -- as not being updatable. [ I know what you claim from the MSDN, though ], but this is what M$ has in my help, note the underlined portions:
Quote:
A snapshot-type CdbRecordset object can contain fields from one or more tables in a database. In a Microsoft Jet workspace, a snapshot can't be updated.

In an ODBCDirect workspace, a snapshot may be updatable, depending on the ODBC driver.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 26-Jul-2007, 05:59
danny77uk danny77uk is offline
New Member
 
Join Date: Jul 2007
Posts: 2
danny77uk is on a distinguished road

Re: CRecordset is read-only when set to snapshot???


I'm not using a Jet database - I'm using SQl server. The MSDN docs do emphasize in several places that non-Jet snapshots can be updated. The only difference is that snapshots have to be requeried to pick up changes to the table, whereas dynastes will show the new record when you move to it.

Thanks for your response anyway. A lot of people have claimed that snapshots cannot be updated but they CAN! So it's either a MS bug/misprint, or we're missing something. I guess people just tried it and when it didn't work, concluded that it wasn't supposed too...
  #4  
Old 26-Jul-2007, 09:13
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,006
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: CRecordset is read-only when set to snapshot???


Good, since I also have SQL server, if I get a chance [might be this weekend, though], I'll try it out.

Note that I've also come across other texts that claim snapshots are NOT updatable because of their nature of being "a moment in time", and the snapshot has to be requeried to reflect any changes that might have been made since the snapshot was taken. This will be a good experiment.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 08:44
Re: Things to Avoid in C/C++ -- gets() , Part 1 WaltP C Programming Language 5 21-Jun-2007 13:13
How to read the data as a whole string? blue1988tx C++ Forum 6 28-May-2007 20:08
php.ini file not being read ian111 Apache Web Server Forum 1 29-Jun-2005 12:35
Scripts not being read... amneziac85 Apache Web Server Forum 2 26-Jan-2004 06:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.