grr, I still say something isn't quite right...

Here's some sample code from SQL Books on using a method with multiple
parameters:
-- Call a method.

EXEC @hr = sp_OAMethod @object, 'Connect', NULL, 'my_server', 'my_login',
'my_password'
IF @hr <> 0
BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
END

Here's my example in my sp:

EXEC @hr = sp_OAMethod @object, 'SetHeader', 'To', '[EMAIL PROTECTED]'

The @hr value is -2147211483, which indicates it has failed.  I'm trying to
call this the same way as the SendMail, except with additional parameters.
The sendmail method I'm using in SQL is:

EXEC @hr = sp_OAMethod @object, 'SendMail'

And this works perfectly.

Is there something else I'm missing here - I mean, there isn't much here :-/

thanks again (more so for your patience!)

Tom


----- Original Message -----
From: Howie Hamlin <[EMAIL PROTECTED]>
To: inFusion Support List <[EMAIL PROTECTED]>
Sent: Wednesday, January 10, 2001 3:11 PM
Subject: Re: [iMS] imsMail COM Object in SQL7


> SetHeader is a method, not a property - so, I think that's where the
problem
> lies.  Here's a snip from one of my many books regarding automation
methods:
>
> ==================================
> sp_OAMethod
>
> You can use this stored procedure to execute a method of the object
> specified by objecttoken:
>
>
> sp_OAMethod objecttoken,
>         method
>         [, returnvalue OUTPUT]
>         [, [@parametername =] parameter [OUTPUT] [...n]]
>
> If the method is a function, the stored procedure can access a return
value.
>
> At the end of the stored procedure's parameter list, you should list the
> parameters of the code components.  The direction of the parameters is
> controlled by the OUTPUT keyword in the usual Transact-SQL manner.
>
> Parameters can be passed both by position and by name.  If passed by name,
> the parametername (when the '@' sign is removed) must match the name of
the
> parameter in the code component.
>
> During execution, sp_OAMethod converts Transact-SQL datatypes to OLE
> Automation datatypes.
> ==================================
>
> More comments below:
>
> ----- Original Message -----
> From: "Tom Langer" <[EMAIL PROTECTED]>
> To: "inFusion Support List" <[EMAIL PROTECTED]>
> Sent: Wednesday, January 10, 2001 3:47 PM
> Subject: Re: [iMS] imsMail COM Object in SQL7
>
>
> > I was hoping someone had some idea of the sql usage.
> >
> > is it possible to make it a single parameter instead of 2??
> >
>
> That would be counterproductive.  It's very easy to call a method with the
> header name and value all at once.
>
> > EXEC @hr = sp_OASetProperty @object, 'smtpto','[EMAIL PROTECTED]'
> > EXEC @hr = sp_OASetProperty @object, 'setHeader_To','[EMAIL PROTECTED]'
> >
> > If you added a bunch more properties, instead of using the properties
> > collection, then it would be a little more compatible with something
like
> > SQL :-)
> >
> > Either that, or make the SetHeader and GetHeader a method that returns a
> > value
> >
>
> All methods in an Automation Object return value.  Of course, the return
> value from this method is not significant.
>
> > x = GetHeader("To")
> >     this returns whatever the To header is set to
> > or
> >
>
> I'm not sure there is really a need for this function...
>
> > x = SetHeader("To","[EMAIL PROTECTED]")
> >     this woudl set the To header to [EMAIL PROTECTED], doesn't need to
return
> > anything.
> >
>
> That's how it works now.
>
> > So, if GetHeader and SetHeader are methods, SQL could use them without a
> > problem, and would be used very similar to the way you are doing it now
> (but
> > you seem to be using a property collection, which again, sql doesn't
seem
> to
> > support).
> >
>
> SetHeader is definitely a method...
>
> > My input - hopefully it's possible!
> >
>
> Anything is possible (probable is another thing altogether :-)
>
> Regards,
>
> Howie
>
>
> > cya
> >
> > Tom
> >
>
>
>
> ========================================================================
>      This list server is Powered by iMS
>    'The Swiss Army Knife of Mail Servers'
>    --------------------------------------
> To leave this list please complete the form at
> http://www.coolfusion.com/iMSSupport.cfm
> Need an iMS Developer license?  Sign up for a free license here:
> http://www.coolfusion.com/iMSDevelopers.cfm
> List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
> ========================================================================
>


========================================================================
     This list server is Powered by iMS
   'The Swiss Army Knife of Mail Servers'
   --------------------------------------
To leave this list please complete the form at 
http://www.coolfusion.com/iMSSupport.cfm
Need an iMS Developer license?  Sign up for a free license here:
http://www.coolfusion.com/iMSDevelopers.cfm
List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
========================================================================

Reply via email to