The reason you are getting this error is because the ToShortDateString()
method returns a String, not a DateTime. Therefore you are actually passing
a String rather than a DateTime. I also want to notify you that in case you
haven't already noticed your getCarSales() method uses two parameters, but
in your example you only pass one (you are not seeing an error for this yet
because you are running into the typecasting error first).
--
Nathan Sokalski
nj********@hotmail.com http://www.nathansokalski.com/
"John" <wh****@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
I have a drop down that is showing dates, I need to pass the selected date
to my proc, so I pass it like this;
getCarSales(Convert.ToDateTime(carTimeFrame.select edItem.value).ToShortDateString());
but when i compile I'm getting the error"
'cannot convert from 'string' to 'system.datetime'
even if i hard code a date i'm getting this error. Now the getCarSales
method as the date as
public DataTable getCarSales(DateTime startDate, DateTime endDate)
{
call's the stored procedure
}
why am i getting this error and ow can i fix it?