SQL Stored proc - passing parameters

H

Harish Mohanbabu

Hi,

I am trying to pass 3 parameters (2 date type and 1 string type) to a sql
stored proc from Excel. But I am getting this error message -

---------------------------
Parameter object is improperly defined. Inconsistent or incomplete
information was provided. The hex errorcode is : E7C
---------------------------

Here is my code snippet -
---------------------------------------------------------------------------
......................
......................
Dim param(3) As ADODB.Parameter
......................

Set Comm = New ADODB.Command

With Comm
..ActiveConnection = Conn
..CommandText = "<STORED_PROC>"
..CommandType = adCmdStoredProc

Set param(1) = .CreateParameter("From_Date", adDate, adParamInput)
param(1).Value = frmDate

Set param(2) = .CreateParameter("To_Date", adDate, adParamInput)
param(2).Value = toDate

Set param(3) = .CreateParameter("Item_Group", adWChar, adParamInput)
param(3).Value = retValue

For i = 1 To UBound(param)
.Parameters.Append param(i)
Next i
End With
---------------------------------------------------------------------------

I am getting the above error message while trying to append the parameters -
particulary the third parameter.

The SQL stored proc works fine when called from SQL query analyzer.

What could be wrong here? Can someone help me please.

Many thanks in advance,

Harish Mohanbabu
 
H

Harish Mohanbabu

I figured out the problem. I forgot to pass the field size ....

Harish Mohanbabu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top