Recordset: counter-type field
Josef Vosyka -- josef.vosyka@vsb.cz
Tuesday, February 06, 1996
Hi,
How do I get counter-type field value (ODBC Access driver)
of a just added record ?
You have discussed this topic before, but I do not know whether
you solved it or not.
Thanks
Joseph
.....
VOSYKA Josef -> SW Engineering, Neural Networks, OOP, Win* Apps
voice (42)69-699 5443, fax (42)69-691 9597
email: Josef.Vosyka@vsb.cz, http://www.vsb.cz/~bs88128
Michael Potter -- mpotter@ezl.com
Wednesday, February 07, 1996
Josef Vosyka wrote:
>
> Hi,
>
> How do I get counter-type field value (ODBC Access driver)
> of a just added record ?
>
> You have discussed this topic before, but I do not know whether
> you solved it or not.
>
> Thanks
> Joseph
>
> .....
> VOSYKA Josef -> SW Engineering, Neural Networks, OOP, Win* Apps
> voice (42)69-699 5443, fax (42)69-691 9597
> email: Josef.Vosyka@vsb.cz, http://www.vsb.cz/~bs88128
=> Ref Q132397 in MSDN
CDatabase db;
db.Open("MYDataSourceName",NULL,NULL,"ODBC;",FALSE);
CCounterSet rs(&db);
// Open up dynaset because any records added by a CRecordset using
// dynasets are appended to the end of Microsoft Access 2.0 recordset
rs.Open(CRecordset::dynaset);
// move to some record
rs.MoveNext();
BOOKMARK bookmark;
rs.GetBookmark(&bookmark);
// Add record. Counter field of record will be given a value by
// the ODBC driver
rs.AddNew();
rs.m_textfield="SomeText";
rs.Update();
// MoveLast to get on record just added
rs.MoveLast();
// retrieve the value of the counter field for the
// newly added record here
// return to the record you were on
rs.MoveToBookmark(bookmark);
Hope this helps,
Mike Potter
mpotter@ezl.com
Simon Wilson -- simon@techsoft.demon.co.uk
Wednesday, February 14, 1996
On Wed, 07 Feb 1996 11:20:54 -0600, you wrote:
>Josef Vosyka wrote:
>>
>> Hi,
>>
>> How do I get counter-type field value (ODBC Access driver)
>> of a just added record ?
[snip]
>=> Ref Q132397 in MSDN
>
Also see article ref. Q132398, as this shows the extra code necessary
to call the ODBC API functions that get the bookmarks to work.
Regards,
Simon.
===========================================================
Simon Wilson Technisoft Ltd.
simon@techsoft.demon.co.uk Macclesfield
Consultancy Services England
Windows (NT), OOP, OOA +44 1625 434533
===================================================
Vincent Mascart -- 100425.1337@compuserve.com
Friday, February 16, 1996
Hi all,
I take the opportunity of this thread to ask a question about counter-type
fields.
I have a counter-type field in my table (called RecordTag). The problem is:
If I use the framework to retrieve the RecordTag field value (using RFX
procedure), the field value is also set by the RFX mechanism when I call
Update() to update (of course) records.
Is there a way to change the RFX mechanism to "read-only" or should if remove
RecordTag from the RFX's and manually retrieve it when browsing my result set ?
Thanks for help.
Vincent Mascart
Little Indian sprl
100425.1337@compuserve.com
| Вернуться в корень Архива
|