Article View: borland.public.cppbuilder.database.ado
Article #3962Re: Updating ADO Fields
From: Murray Marien
Date: Sun, 28 Apr 2002 23:50
Date: Sun, 28 Apr 2002 23:50
73 lines
3717 bytes
3717 bytes
Just an update on this. I created a second sink to examine the variables
after the first sink runs. It's the pEventStatus variable that is not set ??
The cdoMessageStatus EnvelopeField is OK. I'm thinking that there is not a
lot of translation from MS to BCB code here but somehow I didn't get it
right. The interface call is this:
STDMETHODIMP TMySinkImpl::OnArrival(IMessagePtr pMsg,
CdoEventStatus* pEventStatus)
Any help here would be appreciated.
Murray
"Murray Marien" <mm@DigitalMapping.sk.ca> wrote in message
news:3cc824e1$1_2@dnews...
> Hi
>
> I've got a problem that I think is related to ADO. The application is a
> transport event sink for MS SMTP. I used the New ActiveX COM Object to add
> the cdosys.dll:ISMTPOnArrival interface to my application. I think the
> interface uses ADODB for the fields exposed in the interface. That's where
> my problem is. MS code is as follows:
>
> *pStat = cdoSkipRemainingSinks;
> CComPtr<Field> pFldMsgStatus;
>
> pFields->get_Item(CComVariant(CComBSTR(cdoMessageStatus)),&pFldMsgStatus);
> pFldMsgStatus->put_Value(CComVariant((long)cdoStatAbortDelivery));
> hr = pFields->Update();
> if(FAILED(hr))
> return hr;
>
> My code:
>
> *pEventStatus = cdoSkipRemainingSinks;
> FieldPtr pMsgStatus; // pointer to a Message Envelope Field
> if (pMsgStatus = pEnvFields->get_Item (CComVariant
(cdoMessageStatus)))
> {
> if (FAILED (hr = pMsgStatus->set_Value (TVariantInParam
> (cdoStatAbortDelivery)))) {
> MyLogEvent (":failed to set_Value (TVariantInParam
> (cdoStatAbortDelivery))");
> return hr;
> }
> if (FAILED (hr = pEnvFields->Update())) { // doesn't compile
> return hr;
> }
> }
>
> The code sets the cdoMessageStatus field to cdoStatAbortDelivery and the
> EventStatus to cdoSkipRemainingSinks. This should make SMTP drop the
> message.
>
> The difference is the put_Value (MS) and set_Value (BCB) and the lack of
> Update(). MS is insistant that the Update() function be called whereas the
> type library generated by BCB doesn't have the function. So the last two
> lines are commented out in the real code. I assumed that the set_Value()
> automatically updated the field. That doesn't appear to be the case.
>
> The code acts as if the value "cdoStatAbortDelivery" was never set. The
> remaining sinks are called and the message is put in the drop directory. I
> also tried "cdoStatBadMail" which should put the message in the BadMail
> directory, but SMTP ignores that also. So I'm thinking that the
> cdoMessageStatus field is never updated.
>
> The question then, is there a way to update the field ?
>
> Thanks in advance.
>
> Murray
>
>
Technical Details
Message-ID:
<3ccc8ab6$1_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3cc824e1$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,a159ca5a4e283777 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-04-28 17:00:39 PST From: "Murray Marien" <mm@DigitalMapping.sk.ca> Newsgroups: borland.public.cppbuilder.database.ado References: <3cc824e1$1_2@dnews> Subject: Re: Updating ADO Fields Date: Sun, 28 Apr 2002 17:50:16 -0600 Lines: 75 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 142.165.166.25 Message-ID: <3ccc8ab6$1_2@dnews> X-Trace: dnews 1020037814 142.165.166.25 (28 Apr 2002 16:50:14 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news-out.visi.com!hermes.visi.com!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews