Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proper way to reference a stored proc.

Status
Not open for further replies.

JoeCool32

Programmer
Sep 26, 2002
50
0
0
US
I’ve got a stored procedure that I’m trying to reference in my VB code. I’ve tested it in the Query Analyzer and it works fine, but when I run it in my program it bombs. Here’s my proc:

CREATE PROCEDURE deleteContactFeedback
@contactID_pk int
AS
DELETE FROM contactUs WHERE contactID_pk = @contactID_pk
GO

And here’s my VB code:
Code:
Dim objSQLMsgInfo As New SQLComponent()
Dim objSqlUserInfoReturnObject As New SQLReturnObject()
objSqlUserInfoReturnObject = objSQLMsgInfo.ExecuteSqlStatement("sales", "EXEC deleteContactFeedback '@contactID_pk'")
Can anyone determine what’s wrong?

JJ [peace]

"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
 
what message do you get? I cant help with the vb code, but one thing to try may be fully qualifying the proc ie

objSQLMsgInfo.ExecuteSqlStatement("sales", "EXEC server.database.owner.deleteContactFeedback '@contactID_pk'")

might be off the mark there, if not sure someone else will no
 
You need to pass the value of the contactid you wish to delete ie something like

("sales", "EXEC deleteContactFeedback @contactID_pk = " & nnn )


Hope this helps
 
SonOfEmidec: Let me see if I understand you right.

In the sub where I have my SQL statement I define nnn as, say, an integer, then I put it in the codeline as you did.

Is that right?

JJ [peace]

"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
 
joe, yes that is right. your sql statement would be something like:

ssql="exec storedprocname @integerparam=123,@stringparam='data'"
 
Thanks, everyone.

On a side note: I checked this thread for email notification but haven't gotten any emails saying any of you 3 had responded. Is there something wrong w/ that system that I wasn't aware of?

JJ [peace]

"Ignorance and prejudice and fear walk hand in hand" - Witch Hunt, by Rush
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top