I use stored procedures without any problems from my
VB6 Code through ADO.
The proper way to execute them is by using
Command Object and defining the type of command
as Stored Procedure.
Short example is:

    Const c_MaxSize50 = 50
    Const c_MaxOutputSize = 20

    '@ The names of input parameters for my SP.
    Const c_ParNameVirtAssets = "VIRT_ASSETS"
    Const c_ParNameVAssetType = "VASSET_TYPE"
    Const c_ParNameProducer = "PRODUCER"
    Const c_ParNameModel = "MODEL"
    Const c_ParNameClass = "ASSET_CLASS"
    Const c_ParNameSubclass = "ASSET_SUBCLASS"
    '@ the name of output parameter of my SP.
    Const c_ParNameErrCode = "ERR_CODE"

    Dim cmdSP As ADODB.Command   '* command object
    Dim parOutput As ADODB.Parameter    '* parameter object

    '@ Creation of command object
    Set cmdSP = New ADODB.Command

    With cmdSP

        .ActiveConnection = g_conSerw '* that's my active connection to DB
        .CommandText = g_c_SP_IA_CHECK_ASSET  '* that's the name of my sp
        .CommandType = adCmdStoredProc        '* that's the type
        '* Appending parameters
        '@ in parameters
        Call .Parameters.Append(.CreateParameter(c_ParNameVirtAssets,
adBoolean, adParamInput, Value:=(blnVirtAssets)))
        Call .Parameters.Append(.CreateParameter(c_ParNameVAssetType,
adChar, adParamInput, c_MaxSize50, strVAssetType))
        Call .Parameters.Append(.CreateParameter(c_ParNameProducer, adChar,
adParamInput, c_MaxSize50, strProducer))
        Call .Parameters.Append(.CreateParameter(c_ParNameModel, adChar,
adParamInput, c_MaxSize50, strModel))
        Call .Parameters.Append(.CreateParameter(c_ParNameClass, adChar,
adParamInput, c_MaxSize50, strClass))
        Call .Parameters.Append(.CreateParameter(c_ParNameSubclass, adChar,
adParamInput, c_MaxSize50, strSubclass))

        '@ out parameters.
        Set parOutput = .CreateParameter(c_ParNameErrCode, adChar,
adParamOutput, c_MaxOutputSize)
        Call .Parameters.Append(parOutput)

        '@ calling my sp
        Call .Execute

        '@ getting the result from output parameter.
        I_CheckAsset = SetStringVal(parOutput.Value)

    End With

    '* cleaning Command object
    Set cmdSP = Nothing

    ....


this way it should work without any trouble. If you still have problems
with that - let me know, I'll try to help you.

Good luck,

Marcin

U�ytkownik "Tom Brennan" <[EMAIL PROTECTED]> napisa� w wiadomo�ci
news:[EMAIL PROTECTED]
> Hi,
>
>   I am using the SAP ODBC driver 7.04.03, and have a query to make, can
> Visual Basic along with ADO can access/execute stored procedures? I found
I
> can use the SELECT etc but not stored procedures, has anyone encountered a
> work around, if so can you let me know.
>
> Thanks,
> Tom.
>
> /*
> ** #define p printf
> ** p("Better to reign in Hell, than to serve in Heaven");
> ** p("Email - [EMAIL PROTECTED]");
> */
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail



_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to