471,348 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

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 1419
You can use a datetime column, and use SqlDataParameter 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**********************@gmail.com> wrote in message
news:42*************************@msnews.microsoft. com...
You can use a datetime column, and use SqlDataParameter 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("INSERT INTO Table(dateColumn) values(@dateColumn)");
SqlParameter parameter = new SqlParameter("@dateColumn", SqlDbType.DateTime);
parameter.Value = DateTime.Now;
command.Parameters.Add(parameter);
Hi, thanks for your reply.

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

Kind regards
Taz
"Oytun Yilmaz" <oy**********************@gmail.com> wrote in message
news:42*************************@msnews.microsoft. com...
You can use a datetime column, and use SqlDataParameter 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**********************@gmail.com> wrote in message
news:42*************************@msnews.microsoft. com...
SqlCommand command = new SqlCommand("INSERT INTO Table(dateColumn)
values(@dateColumn)");
SqlParameter parameter = new SqlParameter("@dateColumn",
SqlDbType.DateTime);
parameter.Value = DateTime.Now;
command.Parameters.Add(parameter);
Hi, thanks for your reply.

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

Kind regards
Taz
"Oytun Yilmaz" <oy**********************@gmail.com> wrote in message
news:42*************************@msnews.microsoft. com...
You can use a datetime column, and use SqlDataParameter 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brian Burgess | last post: by
4 posts views Thread by m3ckon | last post: by
2 posts views Thread by Robert | last post: by
8 posts views Thread by Zvonko | last post: by
2 posts views Thread by David Garamond | last post: by
4 posts views Thread by John A Grandy | last post: by

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.