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

Pass parameter values to a stored procedure at runtime

Status
Not open for further replies.

VictoriaWass

Programmer
Joined
Jul 14, 2001
Messages
12
Location
GB
None of the previous threads have quite answered this for me.

I have created a datareport which has a dataenvironment datasource, and a stored procedure command datamember. The stored procedure requires an input parameter, and this appears on the parameters tab of the command's properties.

How do I assign a value to this parameter at runtime? The user will chose from a list on screen, and I need to pass through the value they chose in order to produce the correct subset of info on the report.

I think I'm missing something obvious - can anyone help?

Vicky
 
Hi victoria this is the long winded version but will give you all you need. I have an executable that will automatically build this for you. mail robinasia@hotmail.com for a copy.

Rob

Dim adoConn As New ADODB.Connection
Dim ADOCmd As New ADODB.Command
Dim Param As New ADODB.Parameter

adoConn.Open ?????

Set adocmd.ActiveConnection = adoConn

ADOCmd.CommandText = "spAddAuthor"
ADOCmd.CommandType = adCmdStoredProc

Set Param = adocmd.CreateParameter( "@Author",adVarChar,adParamInput,50,0)
Param.Value = me.txtAuthor.text
adocmd.Parameters.Append Param
ADOCmd.Execute
 
Thanks Rob,

I'm still stuck on taking it one step further and getting the result of that command to show up on a report. Any clues?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top