all groups > sql server programming > march 2005 >
You're in the

sql server programming

group:

Dates & Stored Procedure


Dates & Stored Procedure ayman
3/20/2005 8:55:02 PM
sql server programming:
Hi
I want to know how can i Pass tow Dates to Stored Procedure in sql server
2000 by using vb6.

here below my code i used northwind database ,when i run the code i got
error in the cmd.excute .

i thing my problem in passing date, can any when tell me what is the problem

Private Sub Command2_Click()
Call connect
Call setup


Dim cmd As New ADODB.Command
cmd.ActiveConnection = Con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "Employee Sales by Country"

Dim parm As New ADODB.Parameter
Dim parm2 As New ADODB.Parameter

Set parm = cmd.CreateParameter("ShippedDate", adDate, adParamInput, ,
"01/01/1997")
Set parm2 = cmd.CreateParameter("ShippedDate", adDate, adParamInput, ,
"01/01/2005")

cmd.Parameters.Append parm
cmd.Parameters.Append parm2


Dim RST As New ADODB.Recordset
Set RST = cmd.Execute
Set DataGrid1.DataSource = RST
DataGrid1.ReBind
End Sub


Re: Dates & Stored Procedure Aaron [SQL Server MVP]
3/21/2005 12:15:37 AM
What does "got error" mean? Could you tell us the exact error message, and
what line it corresponds to here?


On 3/20/05 11:55 PM, in article
D8DFD5BD-926C-48EA-ACA9-ED7B1743A62D@microsoft.com, "ayman"
[quoted text, click to view]
Re: Dates & Stored Procedure Steve Kass
3/21/2005 12:21:11 AM
Ayman,

The parameters for the sample procedure [Employee Sales by Country] are
named @Beginning_Date and @Ending_Date. You have named both of
your parameters ShippedDate. Could that be the problem?

Steve Kass
Drew University

[quoted text, click to view]
Re: Dates & Stored Procedure Uri Dimant
3/21/2005 7:31:39 AM
ayman
Have you tried to format the dates as 'YYYYMMDD'?





[quoted text, click to view]

AddThis Social Bookmark Button