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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a Stored Procedure in VB

Status
Not open for further replies.

EZEason

Programmer
Dec 11, 2000
213
US
I'm trying to execute a Stored Procedure from VB. It does not pass any varitables. My connection is already open and is working (sqlCn). Here is my code.
Code:
Dim sqlCM As New ADODB.Command
sqlCM.CommandType = adCmdStoredProc
Set sqlCM.ActiveConnection = sqlCn
sqlCM.CommandText = "dbxx.dbo.update_TEMPx"

Set rs2 = New ADODB.Recordset
Set rs2 = sqlCM.Execute
I get an error when it hit the last line of my code.
Runtime Error 214721900(80040e14)
Syntax error or access violation.

Anyone have any suggetions?

What doesn't kill you makes you stronger.
 
Are you able to execute this stored procedure from Query Analyzer?

Also, this is not causing the error but

Set rs2 = New ADODB.Recordset

is not needed because the command.execute method returns a recordset object and overwrites the 'new' one.
 
Yes, I can execute my sp for the Analyzer.
I will also remove the set recordset.



What doesn't kill you makes you stronger.
 
Hi
your code looks perfectly correct.
Please check if there is any issue because of user. Since its a access violation, there might be conflict because of the user.
Please let everyone know when ur problem is solved, and how it is solved.
Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top