date issues..

  • Thread starter Thread starter Jose Luis Balsera
  • Start date Start date
J

Jose Luis Balsera

I don't think you should format dates as string to pass them as parameters to the command object. Simply pass them as DateTime objects
 
ok..i've remove the format dates..but it's still not working..am i putting the correct parameter especially on this statement?thanks

AND order_date BETWEEN @order_date AND @order_date <----
 
chris said:
ok..i've remove the format dates..but it's still not working..am i
putting the correct parameter especially on this statement?thanks

AND order_date BETWEEN @order_date AND @order_date <----

You're specifying the same parameter twice - you need to use

AND order_date BETWEEN @lower_order_date AND @upper_order_date

....

cm.Parameters.Add("@lower_order_date", startDate)
cm.Parameters.Add("@lower_order_date", endDate)
 
And now you are specifying the parameter twice said:
cm.Parameters.Add("@lower_order_date", startDate)
cm.Parameters.Add("@lower_order_date", endDate)

cm.Parameters.Add("@lower_order_date", startDate)
cm.Parameters.Add("@upper_order_date", endDate)
 
Alex Feinman said:
cm.Parameters.Add("@lower_order_date", startDate)
cm.Parameters.Add("@upper_order_date", endDate)

Apologies - that's what I get for posting at 3 in the morning :(
 
Back
Top