Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2002
    Posts
    5

    Question Unanswered: Fujitsu call to sproc via ADO using a parameter

    I am trying to call a stored proc using a parameter via ADO exceute,
    but cannot get the syntac correct.

    Any help is much appreciated.

    thanks,

  2. #2
    Join Date
    Jul 2002
    Location
    India
    Posts
    13
    If your stored procedures doesn't have any output parameter then you can use the execute method of connection object as given below

    Conn.Execute "Usp_GetEmp 1, '01/01/2002'"

    assuming the sp has two input parameters, integer datatype as first parameter and date as second parameter.


    If your stored procedure have output parameters then you have to use the command object of the ADO Object Library.

    I hope this helps you



    Balaji

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    If you need to have a resultset returned from the stored procedure you would have to use the command object as well. If you need to use the command object, please post the stored procedure parameters.

  4. #4
    Join Date
    Dec 2002
    Posts
    5
    Getting a returned result set via exec is OK.

    The problem is with trying to figure out how to set up the parameters array in order to pass the parameters!

    e.g. how would I run something like the [Sales by Year] from Northwind, which requires 2 parameters? (let's say we ignore the ouput)

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Try the following:

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim cmd As ADODB.Command

    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    Set cmd = New ADODB.Command

    cn.Open "Your Connection String"
    With cmd
    Set .ActiveConnection = cn
    .CommandText = "[Sales by Year]"
    .CommandType = adCmdStoredProc
    .Parameters.Append .CreateParameter("Beginning_Date", _
    adDate, adParamInput)
    .Parameters("Beginning_Date").Value = "1/1/1980"
    .Parameters.Append .CreateParameter("Ending_Date", _
    adDate, adParamInput)
    .Parameters("Ending_Date").Value = "1/1/2000"
    End With
    rs.Open cmd

    ' close/destroy the connection, command, recordset objects

    rs.Close
    Set rs = Nothing
    Set cmd = Nothing
    cn.Close
    Set cn = Nothing

  6. #6
    Join Date
    Dec 2002
    Posts
    5
    Thanks.

    Unfortunately I'm looking for Fujitsu COBOL syntax , but I do appreciate your help.

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    Do you have a help file on how to use ado with fujitsu cobol ? If so, please post and I will check it out.

  8. #8
    Join Date
    Dec 2002
    Posts
    5

    Unhappy

    Ahhh. If I had that I wouldn't have had to have posted!! Fujitsu's support refers one to MSDN where one finds solutions such as yours.

    They don't have any documentation re ADOor any examples of how to use it, although their marketing material states specifically that they support it.

    Which is why I posted here in the first place.

    Thanks again.

  9. #9
    Join Date
    Feb 2002
    Posts
    2,232
    You mean to say there is no online help for the ado syntax. What about an object reference - not necessarily a help document. Do you have connection, command and recordset objects ? If all else fails, you could create a com object in vb and reference that in your cobol colde.

  10. #10
    Join Date
    Dec 2002
    Posts
    5
    To say that the documentation is sparse is an understatement. Also what's there is incomplete and/or misleading in some cases, so it's not of much use.

    We could create a component in VB, well Delphi probably, as that's our preferred development platform, but we specifically bought Fujitsu due to its claimed support for ADO. (To be honest, the compiler probably does support ADO, but the documentation isn't saying how, especially in the realm of parameter passing ...

Posting Permissions

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