🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
1 messages
1 total messages Started by MM Tue, 16 Jan 2001 19:07
Returning ADO Recordset
#5932
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads