I have a date field whose datatype is smalldatetime.
Sometimes, some of the date I have stored auto changes to be 1/1/1900.
Why does this happens, is there a way I can fix this? Thanks in advance.
More information please. Do you mean the data is 'stored' in the DB in smalldatetim? I think VB.NET only has 'Date', not 'smalldatetime'. Do you get the values from a textbox or a calendar control?
Might be that you have no value in your date property and when you send the value to the DB, I believe an empty string gets converted to the DB default of 1/1/1900....
The datatype smalldatetime is in SQL Server table.
Yes, I select the date from calender control.
Right now, the date value I store into the table is
in this way:
'dtInvoiceDate is a calender control
invoicedate = dtInvoiceDate.text
I want to use short date e.g. 4/23/2003 without time value.
If I use dtInvoiceDate.value, it gives me date and time.
Is there a way I can use short date using the value property. I wonder if date.text is causing the problem
I'm using a datetimepicker. The format property is defined as Custom. When I select this option it defauls the value to 9/23/2003.
I am using a SP to insert data into the table. The parameter that holds the date is defined as datetime. The datatype for that column in the database is smalldatetime.
Try using the custom Format......that should help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.