Last post Sep 10, 2018 09:37 AM by PatriceSc
Sep 10, 2018 08:57 AM|shallubhalla|LINK
when date as String and pass it to StoredProcedure.
Convert.ToDateTime(model.ToDate, cultureinfo).ToString("yyyy-MM-dd HH:mm:ss.fff")
where ToDate is string in Code and DateTime in SP
where FromDate is Datetime in code
obj.FromDate = DateTime.ParseExact(dates1, "dd/MM/yyyy", cultureinfo);
BETWEEN CAST(CONVERT(varchar, ISNULL(@FromDate, GETDATE() - 365), 112) AS int) AND CAST(CONVERT(varchar, ISNULL(@ToDate, GETDATE()), 112) AS int)
Sep 10, 2018 09:37 AM|PatriceSc|LINK
Never do that. The purpose of using strings is to show data to users according to their country convention and read user input. When working on data (transmitting values to the db, selection, comparison, calculation etc...) you should always work on "native"