Last post Nov 04, 2010 02:56 PM by manoj0682
Nov 04, 2010 01:08 PM|kai_TCM|LINK
I have an application that uses a time date picker control to display a date from a sql (sql 2000) table. Casting from the table to the control works fine, but writing a selected date from the control back to the database does not, I was under the impression
that a datatype 'date' in VB would be compatible with SQL datetime datatime, and obviously it is from sql to vb as the date is correctly displayed in the control reading from the table. How do I need to convert the value from the date time picker control to
write into sql ?
Nov 04, 2010 02:52 PM|Dave_Winchester|LINK
Try something like:
' Use Convert.ToDateTime function.
Dim dt As DateTime = Convert.ToDateTime("04/11/2010")
Hope this helps.
Nov 04, 2010 02:56 PM|manoj0682|LINK
first you need to chech in which format your date time picker date is displaying(suppose if its displaying in dd/MM/yyyy), in that case your sql will take date format in (MM/dd/yyyy). which will give casting problem. just check which format your date is