Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
execute stored proc in Excel William Excel Programming 1 February 5th 06 10:52 PM
DAO recordset Call to SQL Stored Proc Datasort Excel Programming 0 December 1st 05 06:06 PM
Calling stored proc with parameters .. Harish Mohanbab[_3_] Excel Programming 2 September 19th 05 03:58 PM
execte stored proc maxzsim Excel Programming 1 May 10th 05 05:50 PM
Stored Procedure call and passing parameters TLowe Excel Programming 3 April 23rd 04 10:09 AM


All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"