LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Setting Connection Property to pass 3 parameters to an SQL Proc.

I am trying to connect to a SQL Stored Proc and pass 3 parameters. I can
sucessfully pass both date parameters, but the string parameter, @SalesRep in
the procedure gives an error message. "Compile Error, Snytax Error". Below
is the connection string I am attempting to use:

With CMD
.ActiveConnection = CN
.CommandText = "SALES_REP_INFORMATION"
.CommandType = adCmdStoredProc
.Parameters.Append.CreateParameter("@SalesRep", adChar, adParamInput,
strSalesRep)
.Parameters.Append .CreateParameter("@BeginDate", adDate, adParamInput,
, datBeginDate) 'needs to be date
.Parameters.Append .CreateParameter("@EndDate", adDate, adParamInput, ,
datEndDate) 'needs to be date

End With

If I comment out the @Sales Rep the the information passes the date range to
the stored procedure correctly. I am collecting the parameters from specific
ranges on the Excel Sheet. The parameter for @SalesRep is a char(19) within
the stored proc but I am gathering the information as a string in VB.

Help I have check spelling, etc. and am having no luck. Anyone got any
suggestions for other areas to check.

Thanks

Normad

 
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
how to pass on different parameters to VBA Code? Ahmaq Excel Worksheet Functions 2 April 22nd 07 04:30 AM
How to pass address(es) as parameters Pat Excel Programming 12 May 22nd 06 03:15 AM
SQL Stored proc - passing parameters Harish Mohanbabu[_3_] Excel Programming 1 April 20th 06 05:55 PM
How do I pass parameters into Excel from a URL? David Jankowski Excel Programming 0 April 4th 06 09:52 PM
Calling stored proc with parameters .. Harish Mohanbab[_3_] Excel Programming 2 September 19th 05 03:58 PM


All times are GMT +1. The time now is 06:34 PM.

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

About Us

"It's about Microsoft Excel"