Arithmetic overflow error converting expression to data type datetime. The statement has been terminated.
The culture of my site is en-gb (18/10/2010)
The culture of my db server is en-us (10/18/2010)
the date is stored in a param;
command.Parameters.AddWithValue("@bookingdate", inputBookingDate.Text)
Is there a way to convert this to US date format before entering into db?
I tried this code;
Dim dbDate As String = command.Parameters("@bookingdate").Value.ToString
dbdate = DateTime.Parse(dbdate, New CultureInfo("en-US"))
command.Parameters("@bookingdate").Value = dbdate
But get the error 'String was not recognized as a valid DateTime.'
dbDate = "29/10/2010 00:00:00"
How do I specify the current culture? identifying dbDate as a valid datetime in GB format.
Thanks.