SQL Server :: Get Data During Last 24 Hours?
Aug 15, 2010How do I get the data during last 24 hours ?
View 5 RepliesHow do I get the data during last 24 hours ?
View 5 RepliesI can get my records from my database between days with this query.
[Code]....
but i need filter data between hours..
i have a table which records visits to a page, what i want to do is get a count of the last 24 hours and group the visits by the hour.
This is my table structure;
ID, ChannelNewsID, AddDate
This is what i did so far however it gives me both past and future records where as i want 24 hours previously starting from when the query was run. Here is what my query looks like;
[Code]....
I have,hours(in varchar),Id in table tbl_x ,i need the sum of hours, monthyear(eg. mar 2010)for the last three months.But with two separate queries i am getting these results.but actually i need in the following format
Month/Year TotalHours
----------------- ----------------
Mar 2010 0400
Apr 2010 0450
to get month/Year i am using this query
[Code]....
I have a grid view which contains Hours as one of the columns.. now, i need to have a total hours in the footer (sum of hours for all rows).
View 2 Repliesi have 30 data. i want show 24 hours at 24 hours only a data.
View 11 RepliesI have a textfield where they can enter a date, a hour drop down and a minute dropdown.
What I would like to do is after i get the values for each to create a DateObject which has all 3. i.e 12/02/2009 15:36
But then also how dismantle the Date Object to get back my 3 individual values
In my asp.net application I user Microsoft Membership to manage site access security and find the time saved into LastLoginDate is ahead of local time (Eastern Time Zone) 3 hours. What is wrong with it and how to ajust it to local time by application system only such as changing some properties od application?
View 2 RepliesI want to calcultae how many employees are scheduled less 24 hrs for each week,b/w 24 and 48 and greater than 48
In excel file i have weekly wise total hours scheduled for each employee and total no of days scheduled in week(example 6 days and 1 off)which i will upload it to database,based on this i want to display reports in bound controls Result should be like this
Scheduled Hrs 8/1/2010
8/8/2010 8/15/2010 8/22/2010
Less than 24 hrs 5% 5% 5% 5%
Between 24 and 48 hrs 5% 6* 3% 4%
greater tan 48 hrs 90% 89% 92% 91%
can u tell me Which control to use and words in bold are headers and dates should be dyanamic this month it is like shown above, next week it will change.so header should be dynamic.
I have the date format string dd-mm-yy. how to add hours and minutes to the string (i.e 13-03-2010.21.03) ....
DateTime.Today.ToString("dd-mm-yy") ?
How would you calculate the hours?
Example:
05:00 15:00 = 10 hours
07:00 12:00 = 5 hours
12:15 to 14:30 = 2 hours 15 minutes.
I have a c# function for producing thumbnail images, these images are displayed on web-page i.e ASP.netSo how would i programtically call this back-end function let say everyday at 16:00 or at 3:00.
View 3 RepliesI have a web service that sends up to 5000 emails to our customers.
It is called asynchronously from a web application and then chuggs away sending the emails. Generally it works okay. Yesterday, it kept stopping - sometimes after sending a small number (33 first time) and then it might send another couple of hundred - then 50 or so etc. This went on all day as I kept manually calling the web service.
The data (subject, body, fromaddress, replytoaddress etc) is all kept in the database - as are the recipients.
Here's the code that gets the data from the database.
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlCommand myCommand = new SqlCommand("CPEmailsToSend_List", myConnection);
// Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandTimeout = 1000;
[Code]....
So I have a dataset containing 3 sets of data - the subject, body etc., a list of attachments and a list of recipients. I then use the .net smtpClient like this:
Code:
//about to start sending emails - update the MessageSendStatus to inprogress
myCommand.CommandText = "CPEmailSendStatus_Update";
myCommand.Parameters.Clear();
myCommand.Parameters.Add("@CPEmailID", SqlDbType.Int).Value = CPEmailID;
myCommand.Parameters.Add("@SendStatus", SqlDbType.TinyInt).Value = 1;
[Code] ....
When the web service stopped (it kept stopping yesterday) - no errors were raised. I have a function on the page that checks the email address is valid before I try to send the email as I know the smtpClient does not like invalid email addresses. Normally, invalid email addresses are trapped and the loop continues and sends the next one etc. But, yesterday, it just stopped sending. No error messages - nothing.
So, I began to wonder if the Command object is timing out. With a lot of email addresses to send to (up to 5000) and half a dozen attachments - the web service can take a long time (hours) to send all the emails. So, is the fact that I am reusing the command object over and over again for different stored procedures the issue? (I do this a lot and have never had a problem before - I read somewhere that the CommandTimeout only counts the time network access is used).
I've been sending test emails all morning (but I can only send small batches as I have a limited number of email addresses I can send test emails to) and they have all worked okay ... but, yesterday, trying to send about 5000 emails took about 30 attempts.
I have weekly wise scheduled hours of each employee and no of days scheduled for each employee,now i need to calculate no of employees scheduled less than 24 hours,no of emp's scheduled b/w 24 and 48 hrs and emp's scheduled more than 48 hrs in percentage for fisrt week,second week,3rd week and 4th week.
Like this
SCheduled Hrs 8/1/2010 8/8/2010 8/15/2010 8/22/2010
Less tha 24 hrs 5% 5% 5% 5%
b/w 24 and 48 hrs 4% 5% 5% 5%
>48 91% 90% 90% 90%
I have a timespan ts that has mostly minutes and seconds and sometimes hours. I'd like to format a string that'll give these results depending on the data
3:30 (hours not displayed, showing only full minutes)
13:30
1:13:30 (shows only full hours instead of 01:13:30)
So far I have
string TimeSpanText = string.Format("{0:h\:mm\:ss}", MyTimeSpan);
but it's not working.
Schedule Hours for Using WebApp?
View 7 RepliesNot sure if this can be done with ASP.NET, even the concept what I am trying to do...
I have some customers who I would like to send thank you letter automatically who bought online products from our website this day. Ofcourse if a customers buys something, he/she gets the
receipt and an order detail by e-mail. BUT I would like to send to all of the customers an additional e-mail, at same time ( for example 4 PM) to all the customers automatically.
I HAVE the code to send email to a recipent, database which contains all the customers who bought product this day. This works if I open the webpage and for example click a button or other events happen.
Is is possible that at a certain time, the ASP page automatically invokes the method (function) and send automatic E-mails to all customers? Or is this handled by other ways?
Is there a way to show hour in the calendar control?
View 1 RepliesI open my website and it is ok, but if I wait for 1 or 2 hours and click one button. then the page error. However if you reopen it in the new browser window then it is ok again.
The error page is as the following:
Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source Error:
[Code]....
Stack Trace:
[Code]....
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016
How to enforce logon hours validation
View 10 RepliesI deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I increase webservice time out?
View 3 RepliesHow to Retrive records within last 24 hrs using Nhibernate.I want to retrieve the 10 records within last 24 hours.
How can i achieve this using Nhibernate.
In my application I use Forms Authentication and sessions. How do I take care that the user is logged out after a period of 6 hours?
In my web.config I set the sessions time-out to 360 minutes. But after a period of 10 minutes of inactivity I have to login again.
I also set my forms authentication timeout to 360 minutes.
my output is 87:02 hours 87 minutes 2
using (SqlConnection conn = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT CONVERT(VARCHAR(10),InTime,108 ), CONVERT(VARCHAR(10),outTime,108 ) FROM aten WHERE Id = '" + txtid.Text + "' and date between '" +
[Code].....
whenever I replace a master page on my site the pages load after a few hours(1-2) and only after that the site returned to work as normal.. I dont use VS "open web site" from the web method, instead I download the page I want to change (using flashfxp for instance), make my changes and upload it back. I do this process because every now and then the VS stuck/not responding/think long time. he master pages I change are used by few thousand of pages in the site, my thought is that whenever I change a master all the site get rebuild and therefor the long loading time..
View 11 Replies