Help with recordsets: How to get the value of a primary key?
-
I have been struggling with several things in Visual Studio .Net when I upgraded from version 6.0 One thing I have had lots of problems with is the elimination of support for DaoRecordsets. I have an Access database that I want to access, and I am struggling to do it through ODBC. However, one problem I have had that I cannot seem to get past is trying to get the value of a primary auto number key out of a newly added record. With DAO there were a couple of ways to do it: rs.SetBookmark(rs.GetLastModifiedBookmark()); updates the appropriate field in the recordset. Or alternatively, using GetFieldValue which forced the field to be read from the database. CRecordset does not have a GetLastModifiedBookmark function, and when I call GetFieldValue it throws an exception. I've tried various other strategies, but can't seem to find anything that works. Any help would be much appreciated.
-
I have been struggling with several things in Visual Studio .Net when I upgraded from version 6.0 One thing I have had lots of problems with is the elimination of support for DaoRecordsets. I have an Access database that I want to access, and I am struggling to do it through ODBC. However, one problem I have had that I cannot seem to get past is trying to get the value of a primary auto number key out of a newly added record. With DAO there were a couple of ways to do it: rs.SetBookmark(rs.GetLastModifiedBookmark()); updates the appropriate field in the recordset. Or alternatively, using GetFieldValue which forced the field to be read from the database. CRecordset does not have a GetLastModifiedBookmark function, and when I call GetFieldValue it throws an exception. I've tried various other strategies, but can't seem to find anything that works. Any help would be much appreciated.
See this: http://www.codeproject.com/script/comments/forums.asp?forumid=1725&tid=310362&app=50&select=310377#xx310377xx[^] Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill