Insert time value in database

N

Niclas

Hi,

I need to insert a time value from my ASP .Net web application in the format
Minute:Second:Millisecond to a SQL column typed with datetime.

The approach i was thinking of was to instantiate a
System.Data.SqlTypes.SQLDattime with the assigned parameters to form the
time value and pass to the database.

Can someone please advise what best practice is when storing time values in
SQL 2000, and if there is a better approach than the one i have chosen.

Niclas
 
G

Guest

You can bind a DateTime, but not a SqlDateTime, so be careful how you use
each. The SqlDateTime is useful for handing to a stored procedure or placing
in SQL Server via parameters, so it is useful to use. SqlDateTime has the
following constructor:

SqlDateTime(DateTime)

This allows you to use the DateTime in your code and cast into the proper
SQL type to add to a parameter as a value. Very nifty.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
P

Paul Clement

¤ Hi,
¤
¤ I need to insert a time value from my ASP .Net web application in the format
¤ Minute:Second:Millisecond to a SQL column typed with datetime.
¤
¤ The approach i was thinking of was to instantiate a
¤ System.Data.SqlTypes.SQLDattime with the assigned parameters to form the
¤ time value and pass to the database.
¤
¤ Can someone please advise what best practice is when storing time values in
¤ SQL 2000, and if there is a better approach than the one i have chosen.

You may want to post this question to microsoft.public.dotnet.framework.adonet if you don't get an
answer here.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top