×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Need help on simple stored proc calling

Need help on simple stored proc calling

Need help on simple stored proc calling

(OP)
Hello,

I am new at this forum. It's been years since I did classic ASP. I need help with call stored proc.


Stored proc "usp_Stipend_Check_Status"
@record_number
@new_status_id
@comment optional
@rejection_reason_id

my code

CODE -->

Function Submit_usp_Stipend_Check_Status(RecNum, new_status_id, comment, recjReason)
    on error resume next

    Const adCmdStoredProc = 4
    Set cmd = Server.CreateObject("ADODB.Command") 
    if cmd.State <> adStateOpen then Set cmd.ActiveConnection = conn   'conn  'connTest
    cmd.CommandText = "usp_Stipend_Check_Status"

    cmd.CommandType = adCmdStoredProc 'adOpenStatic
    cmd.Parameters("@record_number") = RecNum   'CODE DOESN'T EXECUTE PASS THIS POINT
    cmd.Parameters("@new_status_id") = new_status_id
    if len(comment) <> 0 then cmd.Parameters("@comment") = comment
    if len(recjReason) <> 0 then cmd.Parameters("@rejection_reason_id") = recjReason
    Submit_usp_Stipend_Check_Status = cmd.Execute()
	Set cmd = Nothing 
    LogFile = LogToFile("Call usp_Stipend_Check_Status " & RecNum & ", " & new_status_id)   
    if Err.number > 0 then
        LogToFile(Err.number & ". " & Err.Description)
        Err.Clear
    end if  
    on Error goto 0
End Function 


RE: Need help on simple stored proc calling

Remove the "on error resume next" so you can see what the error is, and on which line.

RE: Need help on simple stored proc calling

(OP)
Guitarzan,

Thank you for responding. I turned off the friendly error message. It returned " Item cannot be found in the collection....bla bla". It seems that it doesn't recognize parameter "@record_number". But all datatype and spelling are correct. It's mysterious to me. Any thought?

RE: Need help on simple stored proc calling

Don't you need to add the parameters to the command before you can access them?

RE: Need help on simple stored proc calling

Quote (Abs 2017)

CODE --> VBA

if cmd.State <> adStateOpen then Set cmd.ActiveConnection =  conn 


Where do you define conn

RE: Need help on simple stored proc calling

(OP)
DaveInIowa is correct on this issue. Thank everyone for helping. Special thanks to Dave. Have a great weekend,

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close