🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Updating ADO Fields

#3959
From: Murray Marien
Date: Thu, 25 Apr 2002 15:46
55 lines
2934 bytes
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: <3cc824e1$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.online.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,a159ca5a4e283777,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-04-25 08:54:06 PST
From: "Murray Marien" <mm@DigitalMapping.sk.ca>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Updating ADO Fields
Date: Thu, 25 Apr 2002 09:46:42 -0600
Lines: 57
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: <3cc824e1$1_2@dnews>
X-Trace: dnews 1019749601 142.165.166.25 (25 Apr 2002 08:46:41 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.online.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews