Results 1 to 5 of 5

Thread: [RESOLVED] Parameters in stored procedure - BLOW UP

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Resolved [RESOLVED] Parameters in stored procedure - BLOW UP

    Hey Gurus,
    I have a stored procedure that has worked perfect, but now that I have changed the DB schema, it blows up when setting the Parameters. This doesnt' make sense to me, since it doesnt' even get as far as executing the procedure, so it can't be DB related.. One more weird thing is that I have an errohandler, but when this error happens, it just leaves the aborts DLL,
    Any ideas??

    Thanks

    Dim SP_Error As String
    Dim SP_ErrorMsg As String
    Dim CN As New ADODB.Connection
    Set CN = Connect_NonSpatial_Tables
    Dim CMD As New ADODB.Command
    With CMD
    .ActiveConnection = CN
    .CommandText = "gdb.pkg_location_planning"
    .CommandType = adCmdStoredProc

    .Parameters("p_type").Direction = adParamInput ' BLows here
    .Parameters("p_type").Value = "R"
    .Parameters("p_location_id").Direction = adParamInput
    .Parameters("p_location_id").Value = lLocID
    .Parameters("p_ring_id").Direction = adParamInput
    .Parameters("p_ring_id").Value = 12345
    .Parameters("p_radius").Direction = adParamInput
    .Parameters("p_radius").Value = .5
    .Parameters("p_user_id").Direction = adParamInput
    .Parameters("p_user_id").Value = 99999
    .Parameters("p_status_code").Direction = adParamOutput
    .Parameters("p_status_desc").Direction = adParamOutput

    .Execute

    SP_Error = .Parameters("p_status_code").Value
    SP_ErrorMsg = .Parameters("p_status_desc").Value
    End With


    '
    '========== this is the structure

    Argument Name Type In/Out Default?
    ------------------------------ ----------------------- ------ --------
    P_TYPE VARCHAR2 IN
    P_LOCATION_ID NUMBER IN
    P_RING_ID NUMBER IN
    P_RADIUS NUMBER IN
    P_USER_ID NUMBER IN
    P_STATUS_CODE VARCHAR2 OUT
    P_STATUS_DESC VARCHAR2 OUT

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Parameters in stored procedure - BLOW UP

    Hmmm.... My Firefox "Mind Reader" Addin must not be working: It doesn't know what "blows up" means....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Parameters in stored procedure - BLOW UP

    Quote Originally Posted by techgnome
    Hmmm.... My Firefox "Mind Reader" Addin must not be working: It doesn't know what "blows up" means....

    -tg
    ...but I agree with TG's sentiments - you should use more technical terminolgy, Debbie (from Florida)...

    Anyway, you need to create ado parameter object and then append it to parameters collection - and that is for each parameter individually:
    VB Code:
    1. Dim param As ADODB.Parameter
    2.  
    3. Set param = cmd.CreateParameter("p_location_id", _
    4.                                 adNumeric, _
    5.                                 adParamInput, _
    6.                                 20, _
    7.                                 lLocID)
    8. cmd.Parameters.Append param

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Parameters in stored procedure - BLOW UP

    If the parameters are being retrieved automatically then the direction property ought to have been already set... try commenting out the lines which set the direction property.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Parameters in stored procedure - BLOW UP

    leinad31 - but the parameters aren't being retrieved automatically or otherwise.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width