Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Stored proc - passing parameters
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 -- Microsoft Dynamics Ax - MVP http://www.harishm.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SQL Stored proc - passing parameters
I figured out the problem. I forgot to pass the field size ....
Harish Mohanbabu -- Microsoft Dynamics Ax - MVP http://www.harishm.com/ "Harish Mohanbabu" wrote: 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 -- Microsoft Dynamics Ax - MVP http://www.harishm.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
execute stored proc in Excel | Excel Programming | |||
DAO recordset Call to SQL Stored Proc | Excel Programming | |||
Calling stored proc with parameters .. | Excel Programming | |||
execte stored proc | Excel Programming | |||
Stored Procedure call and passing parameters | Excel Programming |