Adding field of ShortDate Format?

  • Thread starter Thread starter Andrius B.
  • Start date Start date
A

Andrius B.

Hi all,

I have such a problem. No usefull info on Internet :(

I have a table with several fields, and some of them are of type Date,
having format "Short Date".
At this time I want to add one new colums of type Date, with with short date
format.

I use ADO.NET. For adding the field I use such code:

MainConn.Execute ("Alter TABLE Table1 add column borndate Date")

Such thing of course specifies no Date format. Should I use smth like
"...add column borndate ShortDate" or smth else?

I would prefer not to use other objects like provided by Access or DAO.

Thanks in advance.
 
At this time I want to add one new colums of type Date, with with short
date
format.

I never keep formatted dates in a database. If you keep the date as an
integer (number of days from a fixed start date) it is quicker to search
and do calculations on - and you can format it how you like once you have
extracted it.
 
Hi Andrius,

Just make sure you use an SqlParameter with the SqlDbType.Date to transfer
to/from .Net and Sql and you should be fine. Formatting is only relevant
when you want to display the dates, in which case you can use a DateTime
format in any way you want.
 
Back
Top