I have a asp.net application with MS Access database with ole db connection. On debugging the solution with IIS, when selecting a value from database and converting it to date time i will change the date time format from "dd/MM/yyyy" to MM/dd/yyyy and throw an error? Please suggest a solution for this?
strQuery += " WHERE (CDate(Shift.[ShiftDate])>=CDate('" + new DateTime(selectedDate.Year, selectedDate.Month, 1).ToShortDateString() + "') and CDate(Shift.[ShiftDate])<=CDate('" + new DateTime(selectedDate.Year, selectedDate.Month, 1).AddMonths(1).AddDays(-1).ToShortDateString() + "'))";
I bet you have different culture on your iis server and debug environment. Pass culture to parsing method.
DateTime.Parse(dateStringVar, new CultureInfo("en-US", false));