Results 1 to 2 of 2

Thread: Call COM Method from a trigger

  1. #1
    arun Guest

    Call COM Method from a trigger

    Is there a way to instatiate a COM Component and use it in a Strored Proc / Trigger.

    If anybody can help then I would be greatfull.

    Thanks,


  2. #2
    Juergen Leis Guest

    Call COM Method from a trigger (reply)

    use sp_OACreate, sp_OASetProperty, sp_OAGetProperty, sp_OAMethod, sp_OADestroy

    e.g.:

    DECLARE @object int
    DECLARE @hr int

    /* for example a Word Document */

    EXEC @hr = sp_OACreate 'Word.Document', @object OUT
    IF @hr <> 0
    BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
    END

    EXEC @hr = sp_OASetProperty @object, &#39;PropertyName&#39;, &#39;PropertyValue&#39;
    IF @hr <> 0
    BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
    END

    EXEC @hr = sp_OAMethod @object, &#39;PropertyName&#39;, NULL, &#39;Parameter1Value&#39;, ...
    IF @hr <> 0
    BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
    END

    EXEC @hr = sp_OADestroy @object
    IF @hr <> 0
    BEGIN
    EXEC sp_displayoaerrorinfo @object, @hr
    RETURN
    END


    ------------
    arun at 1/7/2002 5:28:14 PM

    Is there a way to instatiate a COM Component and use it in a Strored Proc / Trigger.

    If anybody can help then I would be greatfull.

    Thanks,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •