PC Review


Reply
Thread Tools Rate Thread

Adding field of ShortDate Format?

 
 
Andrius B.
Guest
Posts: n/a
 
      16th Jul 2009
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.




 
Reply With Quote
 
 
 
 
Jeff Gaines
Guest
Posts: n/a
 
      16th Jul 2009
On 16/07/2009 in message <(E-Mail Removed)> Andrius
B. wrote:

>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.

--
Jeff Gaines Damerham Hampshire UK
640k ought to be enough for anyone.
(Bill Gates, 1981)
 
Reply With Quote
 
Morten Wennevik [C# MVP]
Guest
Posts: n/a
 
      16th Jul 2009
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.

--
Happy Coding!
Morten Wennevik [C# MVP]


"Andrius B." wrote:

> 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.
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert null value in column-type is date/time & format is ShortDate,in Access 2002 billypit786@gmail.com Microsoft Access Forms 2 22nd Apr 2008 09:53 PM
Setting the System's ShortDate Format in RunTime =?Utf-8?B?Q29ubnVsbA==?= Microsoft VB .NET 7 18th Jun 2007 07:50 AM
ShortDate Format changing for no reason. Martin Stephenson Microsoft Windows 2000 Developer 0 20th Mar 2004 10:15 AM
Formating cells to only accept ShortDate format JShrimps, Jr. Microsoft Excel Programming 4 10th Dec 2003 03:04 AM
PPC 2003 - Wrong shortdate format Richard Kvist Microsoft Dot NET Compact Framework 2 22nd Aug 2003 01:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:21 AM.