🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #5932

Returning ADO Recordset

#5932
From: MM
Date: Tue, 16 Jan 2001 19:07
47 lines
2125 bytes
Hi All,

Given this idl definition of a method:

[id(0x00000001)]
HRESULT _stdcall computeRecordSet([out, retval] _Recordset ** res );

and the corresponding code generated by BCB:
STDMETHODIMP TADOTestServerImpl::computeRecordSet(_Recordset** res)
{
}

is this the correct way of generating the returned Recordset object?

STDMETHODIMP TADOTestServerImpl::computeRecordSet(_Recordset** res)
{
    _Recordset* rs = CoRecordset::Create();
    Fields* fields = rs->Fields_;
    BSTR colName = WideString("Column1").Detach();
    fields->Append( colName,
                   adVarChar,
                   50,
                   adFldIsNullable | adFldMayBeNull | adFldUpdatable
                   );
    fields->Update_();
    Field* fld = fields->get_Item( int(0) );

    rs->Open(TNoParam(),TNoParam(), adOpenKeyset, adLockOptimistic, 0);

    rs->AddNew();
    fld->set_Value("New field value");
    rs->Update_();
    *res = rs;
    return S_OK;
}

The definition of _Recordset is obtained by importing the ADO 2.5 type
library.

Is there a wrapper for the ADO classes that is COM compatible i.e can be
used in cases such as the above where you have to return instances of
various ADO classes to VB clients?

Any help would be much appreciated.
Thanks

-MM
Technical Details
Message-ID: <3a649b6e$1_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out.usenetserver.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!dnews!216.79.109.66

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,9fe34cdfc56cdc9d,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-01-16 11:12:09 PST
From: "MM" <m.m@softhome.net>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Returning ADO Recordset
Date: Tue, 16 Jan 2001 14:07:38 -0500
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 216.79.109.66
Message-ID: <3a649b6e$1_2@dnews>
X-Trace: 16 Jan 2001 11:05:18 -0800, 216.79.109.66
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out.usenetserver.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!dnews!216.79.109.66