.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

Calculating working time

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :

I have a project to calculate the time duration for each employee each day he get inside the site. the data coming from 2 linked database. the duration should be calculated from alarm event table any time the employee access one of dedicated gate. I have add a sub-query on my root query to aggregate the clocking-in and clocking-out. The case give ’01’ as clocking-in and ‘02’ as clocking-out.

Now what is missing is calculating the duration time each employee worked each day provided that he/she might clock-in and clock-out several time a day or he/she might work on shift between two day. 

please help me complete my attached script

 CardHolderTable.FirstName + ' ' + CardHolderTable.LastName AS [Emp. Name],
 ViewSMSCardHolderPersonalData1_25.[Personal Data 2] AS Department,
 ViewSMSCardHolderPersonalData1_25.[Personal Data 3] AS [Job Title],
 ViewSMSCardHolderPersonalData1_25.[Personal Data 5] AS [Company Name],
 ViewSMSCardHolderPersonalData1_25.[Personal Data 6] AS [Projec

View Complete Post

More Related Resource Links

can anyone tell me why setInterval is not working properly i want to display the time every seconds,

setInterval is suppose to execute the script every second there getting the most uptodate time of day , but it does not update it stays the same
      <script type="text/JavaScript">

          function interval() {
              setInterval("time()", 1000);
          function time() 
              var d = new Date();
              var time = d.getHours();
              var time2 = d.getMinutes();
              var time3 = d.getSeconds();

              document.write(" : ");
              document.write(" : ");
  // -->
      <input type="button" OnClick="interval()" value="Click Me!"/>


Delete not working all the time.

From time to time i am getting this error when attempting to delete a file. Exception Details: System.IO.IOException: The process cannot access the file 'D:\gallery\images\Untitled-1.jpg' because it is being used by another process. And the times i see it most is if i upload the image and then within seconds try to delete the image. Is there anything that can be done on my part to help prevent this? 

"Remember Me Next Time" under Login Control is not working

I am using VS 2005 and created a Login control. Login control provides "Remember Me Next Time" check box, I check this box but it does not remember next time. I have following entry in the web.config file <authentication mode="Forms"> <forms name=".MyCookies" loginUrl="login.aspx" protection="All" timeout="5000000" cookieless="UseCookies" slidingExpiration="true" path="\"></forms> </authentication> What am I missing? Thanks

Previous working date - Time dimensions


Hi all,

I need an mdx to get the previous working day. 

I`ve got my complete time dimension, including weekends.  Every day member has got a Member Property that says wether it is a working day or not.  See table below.  Then, I need an mdx expression to return the "Prev working Day".  Any idea??



day of the month IsWorkingDay Prev Working Day
01/09/2010      1



I am facing the following error:

"Hotfix installer has stopped working" when i try to install the MS SQL Server 2005 update using Windows Update.

My OS is MS Vista Ultimate version


Please help.


Thank you


working with 3 dropdownlists at a time


i am using 3 dropdownlists namely state, city,zip. Once we select  "state" dropdown list ,that state contained "cityes" are displayed.and "cityes" dropdown list selected that city contained "zip" values are displayed.Once we selected state in state dropdownlist,that state contained cyties are displayed at cities dropdownlist. then we want to select another state again we select another state at that time state dropdown box display doplicate values. The duplicate values are comming in run time. how will over come from this duplicated values in drop down list. please help me...

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

Why for the first time my call to web service is not working


Hi ,

I have a web service hosted on windows 2003 server.

When I make a call to that web service for the first time its returning 'xml response not well formed', but from second time onwards its working fine. Again to solve this problem I removed all my soap header and everything that i suspected but its still showing the same error for the first time when i tried to call any method of the web service.


can you please suggest me what should I do ?


First Time Creating a StoreProc; Not Working Very Well...


I am trying to create a StoreProc to sweep data from a .csv file, saved on a network drive, to a Table, in SQL Server.  I’m kind of new to SQL Server, and need a little help with this task.  I thought this link offered a good suggestion:



So, I created my StoreProc; it looks like this:

-- ================================================

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

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.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

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.
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