I have a problem
My Sql db is sat on a server which i guess is in U.S.A format cos dates are mm/dd/yyyy however im in england and the application is going to be used in england which is formatted like dd/mm/yyyy so in my code ive got this
VB Code:
Dim dteStartDate As Date = CDate(Format(Me.StartDate.Value, "MM/dd/yyyy")) Dim Cmd As New SqlCommand("InsCalAppointment", MyConnection) With Cmd Try .CommandType = CommandType.StoredProcedure .Parameters.Add("@dteStartDate", DbType.Date).Value = dteStartDate .ExecuteNonQuery() Catch er As Exception MsgBox(er.ToString) End Try
Can any one help me plleaseeeeeAn unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from string "12/16/2003" to type 'Date' is not valid.




Reply With Quote