473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Insert time value in database

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
Dec 29 '05 #1
2 1758
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!
***************************
"Niclas" wrote:
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

Dec 29 '05 #2
On Thu, 29 Dec 2005 12:50:20 -0000, "Niclas" <li*************@hotmail.com> wrote:

¤ 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)
Dec 29 '05 #3

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

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
5
by: SSP | last post by:
Dear ASP.NETers, How would I insert multiple rows of data from a web form? Are there any tute's and stuff around. Couldn't find any myself. Thanks in advance. SSP
1
by: ven | last post by:
hello i`m makin a asp.net service with database connection where i have an insert with decimal value, when i run my function i get this error : There are fewer columns in the INSERT statement...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
2
by: r_o | last post by:
hi i'm new to this issue i'm developping a web application with an access database in my application there's a loop that gets values of a form like: lastElt=request("numberOfItems") for...
14
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.