sp_OAMethod when input variable is an array

  • I'm need to use vb6 dll to decrypt a value.

    In VB a call to this method would look like the following:

    ---------

    Public Function Decrypted(ByVal MemberID As String, ByVal Data As String) As String

    Dim InPar As Variant

    Dim OutPar As Variant

    InPar = Array(Data, MemberID)

    oSession.ExtFunction "decryptnum", InPar, OutPar

    Decrypted = CStr(OutPar)

    ---------

    As you can see the input variable is an array.   Is there any way to fake it out?   The following returns an error (note i left out some misc code).

    --------

    DECLARE @retVal INT

    DECLARE @comHandle INT

    DECLARE @retString VARCHAR(100)

    DECLARE @InPar varchar(1000)

    DECLARE @OutPar varchar(1000)

    select @InPar = 'BC32C91C59D60772191C8A68BF1C7C'

    sp_OACreate 'FeSLib4.clsSession', @comHandle OUTPUT
    sp_OAMethod @comHandle, 'ExtFunction', @retString OUTPUT,'decryptnum',@InPar
    --------
  • Looking at your sql code, you would like @InPar to be a byte array?

    If this is the case, you could try storing @InPar as a VARBINARY (it probably won't work but give it a shot)

    Your best bet would probably be to write a wrapper around your VB6 dll (or expose a different interface). This way you could accept your input parameters in a more friendly format and parse them out however you want them.

    (I'm also assuming you aren't using 2005)

    Let me know!

    Thanks,

    Robert

    SQL guy and Houston Magician

  • We were thinking about writing a wrapper but trying to avoid it.   I think this may be our only option.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply