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

Running Stored Procedures

Status
Not open for further replies.
Jun 28, 2002
34
0
0
GB
All

Can someone please tell me how you run a SQL 7 Stored Procedure via Visual Basic 6 using ADO code. I have read that running Stored Procedures will speed up the response of the query.

Many thanks
 
This is an uninformed reply, but without even looking it up, can't you set up a querydef object?
 
This issue has been address numerous times in this forum. To get a list of the pertinent threads, click on the Keyword Search tab, enter stored procedure in the keyword, I would also set the Use radio button to All Words, and the When radio button to Any Date.

The results from the search should provide you with everything you need. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
An example will do it.

This is a sp with only one parameter (integer) but is easily extended.

Code:
  Dim lCmd As New ADODB.Command
  Dim lP1 As New ADODB.Parameter
    
  lCmd.CommandText = "sp_BorrarRecibosVenta"
  lCmd.CommandType = adCmdStoredProc
  
  lP1.Type = adInteger
  lP1.Direction = adParamInput
  lCmd.Parameters.Append lP1
  
  Set lCmd.ActiveConnection = miConexion ' mi global ADO connection
  lCmd(0) = nroReciboID   ' Here I actually assign the parameter value with a variable
  lCmd.Execute

Good luck

Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top