.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

record time

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

I want to record the time it takes between button presses in asp.net.
I need the answer in total secs and how do i do this?
I know Now() gets current time. 

View Complete Post

More Related Resource Links

Can this code be setup to run against the whole database instead of just 1 record at a time?


We have made some changes to this code to start capturing 1 new field of data and updating it as new records are added. But there is currently about 120,000 records more or less.. those records of course dont have the new field populated with anything..

We would like to run this logic that already in place and run it against the tables to update the fields 1 time. I think to make it easier, if it can be setup to expect the "valueTwo" variable, so that we can run it againt the individual codes instead of doing all the records at one time.. there are codes that only have a few records, so it would be best to test initially against the small code group.


            strSqual = "insert into trans (trans_type_name, trans_date,sys_id,mod_user_id,show_ind, remoteCode, techName) values('" & valueTwo & "','" & TransDate & "',"&strSystemID&", 1,'T', '" & dbQuote(strUser) & "', '" & strTechName & "')"        
            'get the new transaction_id out for just inserted alarm   
            strSqual = "select max(transaction_id) as transaction_id from trans"  
            set rst = getStaticRecordSet(strSqual)

How can i update treeview root node every time based on the record entries

Hi all, I will have an mdi form and with a treeview which has it's initial property as visible =false. If i select an option from menu a child form will exists i will fill some details and click on save when ever click on save i will make the root node of the treeview to some name as File[batch count:0]. Now if i select another option from menu another form will appear and if i fill it with some details and click on save i would like to change the root node name to File[batch count:1] and a child node should exists with some name

How can I discover máx time in which a record hasn´t been added


Hello everyone, I would like to salute you before I beggin, being this my first post. The forum is great and it has been a big help during some work. Thanks a lot to every guru that takes the time to answer.

Ok, the situation is this:

A machine counts materials as they are being processed and store those records into a SQL Server like this:


DATETIME                                 P_ID         ARRAY_COUNT

2010-09-03 13:10:21.070 6 1

2010-09-03 13:15:02.013 6 1

2010-09-03 14:07:46.300 6 1

2010-09-03 14:09:47.053 6 1

2010-09-03 14:38:36.107 6 1


Everytime a material has been processed, a line is inserted into that table.


Now, lets say I would like to know when the machine has been idle for 5 minutes or more and store the resulting data into a new temporary table and show it to the user. That would also tell

Returning record from History Table as it would have existed at a specific date/time


I have a table that uses a trigger to save changes (old values) to a history table. This process is working fine, and I have reports that detail the history of a record for the end user. My problem is that the end user now wants a report that will retrieve how the record looked at a specific date/time.

Source Table:

Id	First	Last	Active	Date
1	John	Doe	1	10/25/2010
2	Jane	Smith	1	10/25/2010

History Table:

Id	SourceId	First		Last	Active	Date
1	1		Jonathon	NULL	NULL	5/1/2000
2	2		NULL		Gray	NULL	10/1/2000
3	2		NULL		Smith	NULL	6/15/2003
4	2		NULL		Doe	NULL	11/23/2008

If the user queries for SourceId 2 on 1/1/2009, they need to get:

Id	First	Last	Active
2	Jane	Smith	1

I've used COALESCE searching multiple fields, but I need to figure out how to

Calculating a time difference between two record and print as time_difference in MS Sql Query


Hi to all,

i dont think so its a big task but due to some reason i could not get a proper return value its returning me null which seems to be some thing is wrong in query entries that was not executing in proper way me just writing my query here could you please check where i am wrong.

dbo.ProjectA.Datestamp as Datetime1,
DateDiff(second, dbo.ProjectA.Datestamp, (select top 1 dbo.ProjectA.Datestamp from dbo.ProjectA where datepart(minute,dbo.ProjectA.Datestamp) > Dateadd(Minute,1, datepart(minute,dbo.ProjectA.Datestamp) ))) as time_difference

from dbo.ProjectA

Where (dbo.ProjectA.Datestamp between CONVERT(Datetime, '2010-09-09 06:00:00', 102)and CONVERT(Datetime, '2010-09-09 18:00:00', 102))

Group by LineID,dbo.ProjectA.Datestamp, dbo.ProjectA.ProductCod

Having (dbo.ProjectA.LineID = '1' )

order by  dbo.ProjectA.Datestamp

LineID    ProductCod             Datestamp                  time_difference
1         prdAitmq4673     2010-09-09 06:05:57.090    NULL
1     &nb

How Access one Record in two user in at a time


i have one issue access the record for SQL Server. i have 10 record in one table more the one user access the particular table records. one record access for one user how control other user access same record

please help me on this

Round off time to the nearest minute

How would you round this up to the nearest minute? There isn't a built in function to do this so you have to use a little bit of maths to get there. There are 60 seconds in a minute. We already have 38 seconds on the clock. So we need to add on 60 - 38 = 22 more seconds.

GridView inline Master/Detail record display

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right) you may want to review the source code.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.

Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

How to programmatically add controls to Windows forms at run time by using Visual C#

Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:

.NET 4 Web Application Startup Time

I was chatting with Jonathan Hawkins and some of the folks on the ASP.NET team about performance and Jonathan mentioned the startup time for large ASP.NET applications is improved on .NET 4. There are some improvements in the CLR and in ASP.NET itself that helped. If you have a giant app, you should do some tests.

Built-in Functions - Date and Time Functions

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

Essential SQL Server Date, Time and DateTime Functions

The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.

Date/Time Conversions Using SQL Server

There are many instances when dates and times don't show up at your doorstep in the format you'd like it to be, nor does the output of a query fit the needs of the people viewing it. One option is to format the data in the application itself. Another option is to use the built-in functions SQL Server provides to format the date string for you.

Date and Time Data Types and Functions

The following sections in this topic provide an overview of all Transact-SQL date and time data types and functions. For information and examples that are common to date and time data types and functions
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend