473,549 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Correct way of storing a date?

Hi, i am trying to store a users date of birth, within my application i will
store it as a datetime object, however what is the best way to store it in
the database (SQL SERVER)?

Thanks for any help!
Regards
Taz
Feb 8 '06 #1
4 1486
You can use a datetime column, and use SqlDataParamete r in your insert command
Hi, i am trying to store a users date of birth, within my application
i will store it as a datetime object, however what is the best way to
store it in the database (SQL SERVER)?

Thanks for any help!
Regards
Taz

Feb 8 '06 #2
Hi, thanks for your reply.

Icannot find this method on msdn, could you elaborate slightly?

Kind regards
Taz

"Oytun Yilmaz" <oy************ **********@gmai l.com> wrote in message
news:42******** *************** **@msnews.micro soft.com...
You can use a datetime column, and use SqlDataParamete r in your insert
command
Hi, i am trying to store a users date of birth, within my application
i will store it as a datetime object, however what is the best way to
store it in the database (SQL SERVER)?

Thanks for any help!
Regards
Taz


Feb 8 '06 #3
SqlCommand command = new SqlCommand("INS ERT INTO Table(dateColum n) values(@dateCol umn)");
SqlParameter parameter = new SqlParameter("@ dateColumn", SqlDbType.DateT ime);
parameter.Value = DateTime.Now;
command.Paramet ers.Add(paramet er);
Hi, thanks for your reply.

Icannot find this method on msdn, could you elaborate slightly?

Kind regards
Taz
"Oytun Yilmaz" <oy************ **********@gmai l.com> wrote in message
news:42******** *************** **@msnews.micro soft.com...
You can use a datetime column, and use SqlDataParamete r in your
insert command
Hi, i am trying to store a users date of birth, within my
application i will store it as a datetime object, however what is
the best way to store it in the database (SQL SERVER)?

Thanks for any help!
Regards
Taz

Feb 8 '06 #4
Many thanks!

Appreciate your help,
Regards

"Oytun Yilmaz" <oy************ **********@gmai l.com> wrote in message
news:42******** *************** **@msnews.micro soft.com...
SqlCommand command = new SqlCommand("INS ERT INTO Table(dateColum n)
values(@dateCol umn)");
SqlParameter parameter = new SqlParameter("@ dateColumn",
SqlDbType.DateT ime);
parameter.Value = DateTime.Now;
command.Paramet ers.Add(paramet er);
Hi, thanks for your reply.

Icannot find this method on msdn, could you elaborate slightly?

Kind regards
Taz
"Oytun Yilmaz" <oy************ **********@gmai l.com> wrote in message
news:42******** *************** **@msnews.micro soft.com...
You can use a datetime column, and use SqlDataParamete r in your
insert command

Hi, i am trying to store a users date of birth, within my
application i will store it as a datetime object, however what is
the best way to store it in the database (SQL SERVER)?

Thanks for any help!
Regards
Taz


Feb 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3859
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any new site I goto seems to prompt me to store their cookie. The other is Pocket IE on Pocket PC 2002, with the cookies set to 'enabled'. My...
4
6516
by: m3ckon | last post by:
HI there, I currently store the date using the getdate() function but how can I store just the time or seperate the time off from a datetime datatype? M3ckon *** Sent via Devdex http://www.devdex.com ***
2
1803
by: Robert | last post by:
I have no problem storing dates + times in a System.DateTime object. In addition, it's easy to output a Time as a string from an existing Date/Time. But I'm having trouble storing a time only. Is there any way to store only a time without the date portion (like 3:00 am) in this data structure? Or, if not, is there another data structure...
8
3359
by: Zvonko | last post by:
Hi! I would like to get the clients date and time (his system time) and store it somewhere so I can use it in my code later. (insert it to database!). Any ideas Zvonko
2
2473
by: David Garamond | last post by:
What would be the more proper way of storing birthday data? It will be used to send out birthday messages for customers ("Happy 30th birthday, Sam!"). But the date of birth is not necessarily known (in which case, we will only send out "Happy birthday, Sam!"). I prefer using the builtin date type instead of three smallints. But I don't like...
11
2328
by: James Hallam | last post by:
I have read through all the past topics and couldn't find what I was after so... I am looking to store some calculated values (don't flame just yet, just read on!). I have an piece of code behind a form which calculates a percentage completion and an expected completion date of a job. I would like to store this information in a separate...
2
1202
by: sonasiva | last post by:
hai I need to write a code for register page of my website i have written the following code, <% DIM strusername, strpassword, stremail strUsername =request.form("username") strPassword = request.form("password") strEmail = request.form("email")
7
3242
by: fauxanadu | last post by:
Is it possible to store dates before 01/01/0100 A.D. (such as for as database storing world events would require) using MS Access? Verbose Explination I need to be able to store dates before 100CE in a date field. This is for a world history database that I am building. I am currently storing dates in a database as unformatted text (14...
4
1844
by: John A Grandy | last post by:
What are some best practices for storing pure dates and pure times in .NET ? I notice that DateTime.TimeOfDay() returns type TimeSpan , which is certainly sufficient for storing pure times , but not constrained ... Do people write their own classes ? Or have I overlooked one or more intrinsic .NET classes ?
0
7527
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.