Hi
I'm trying to execute store procedure with multiple input parameters but sql server isn't recognising the parameters that I am passing.
The error message is "procedure ....expects parameter @Period, which was not supplied. It's breaking on the execute bit.
I've tried naming the parameter with and without @in front
Has anyone else had this problem before and know how to fix it???
I'm using SQL Server 2000 and Access 2002Code attached
Thanks
Private Sub Command1_Click()
Dim cnn1 As ADODB.Connection
Dim rstClients As ADODB.Recordset
Dim adoCommand As ADODB.Command
Dim prmPeriod As ADODB.Parameter
Dim prmOffice As ADODB.Parameter
Dim prmDept As ADODB.Parameter
' Open connection.
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
'opens command for stored proc
Set adoCommand = New ADODB.Command
Set adoCommand.ActiveConnection = cnn1
adoCommand.CommandText = "_StoredProcName"
adoCommand.CommandType = adCmdStoredProc
adoCommand.CommandTimeout = 15
'set paremeters
'adocommand.
Set prmPeriod = adoCommand.CreateParameter("@Period", adInteger, adParamInput)
adoCommand.Parameters.Append prmPeriod
prmPeriod.Value = 200312
Set prmOffice = adoCommand.CreateParameter("@Office", adChar, adParamInput, 8)
adoCommand.Parameters.Append prmOffice
prmPeriod.Value = LON
Set prmDept = adoCommand.CreateParameter("@Dept", adInteger, adParamInput, 8)
adoCommand.Parameters.Append prmDept
prmDept = ALL
Set rstClients = adoCommand.Execute
rstEmployees.Close
cnn1.Close
I'm trying to execute store procedure with multiple input parameters but sql server isn't recognising the parameters that I am passing.
The error message is "procedure ....expects parameter @Period, which was not supplied. It's breaking on the execute bit.
I've tried naming the parameter with and without @in front
Has anyone else had this problem before and know how to fix it???
I'm using SQL Server 2000 and Access 2002Code attached
Thanks
Private Sub Command1_Click()
Dim cnn1 As ADODB.Connection
Dim rstClients As ADODB.Recordset
Dim adoCommand As ADODB.Command
Dim prmPeriod As ADODB.Parameter
Dim prmOffice As ADODB.Parameter
Dim prmDept As ADODB.Parameter
' Open connection.
Set cnn1 = New ADODB.Connection
cnn1.Open strCnn
'opens command for stored proc
Set adoCommand = New ADODB.Command
Set adoCommand.ActiveConnection = cnn1
adoCommand.CommandText = "_StoredProcName"
adoCommand.CommandType = adCmdStoredProc
adoCommand.CommandTimeout = 15
'set paremeters
'adocommand.
Set prmPeriod = adoCommand.CreateParameter("@Period", adInteger, adParamInput)
adoCommand.Parameters.Append prmPeriod
prmPeriod.Value = 200312
Set prmOffice = adoCommand.CreateParameter("@Office", adChar, adParamInput, 8)
adoCommand.Parameters.Append prmOffice
prmPeriod.Value = LON
Set prmDept = adoCommand.CreateParameter("@Dept", adInteger, adParamInput, 8)
adoCommand.Parameters.Append prmDept
prmDept = ALL
Set rstClients = adoCommand.Execute
rstEmployees.Close
cnn1.Close