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

Top 5 Contributors of the Month
Post New Web Links

The TimeSpan could not be parsed because at least one of the hours, minutes,.....

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

One of my users is getting the following error:  

The TimeSpan could not be parsed because at least one of the hours, minutes, or seconds components is outside its valid range.

Here is what I have pin pointed it down to:


cmd.CommandText = "InsertExportPairing";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("@pn", SqlDbType.VarChar, 50).Value = pairing.Number;
        cmd.Parameters.Add("@pt", SqlDbType.Time, 7).Value = pairing.FlightTime.Insert(2, ":");
        cmd.Parameters.Add("@date", SqlDbType.Date).Value = DateTime.ParseExact(pairing.Date, "MMM dd, yy", CultureInfo.InvariantCulture);
        cmd.Parameters.Add("@uid", SqlDbType.Int).Value = userID;
        SqlParameter outParam = cmd.Parameters.Add("@newId", SqlDbType.Int);
        outParam.Direction = ParameterDirection.Output;


View Complete Post

More Related Resource Links

filtering by minutes and hours

guys, is there a way where i can filter my data based on the minutes and hours ie i already have the start date and end date.. i need to filter by the time as well. any help?

Get Difference between two dates as Hours, Minutes



 I am using the below query to get difference beiween two dates in hours and minutes.Minutes part look ok but the hours is incorrect.

 select datediff(minute,LastDate,getdate()) as "Minutes", datediff(hour,LastDate,getdate()) as "Hours"from emp.

 Note: Using SQL Server 2005


How to Get Total Minutes From Hours in SQL Server 2005?


Hi All.........!

I have 10:45 Hours and Now I want to get Total Minutes Like 645 Minutes.

How Can I Get in SQL Server 2005?

Please Help Me................!

Thanks in Advanced..............!

Difference between 2 times 6:00 Hours - 5:50 hours is 10 minutes i.e 0.10 How to do the same in SSRS


Hi I have a report where I have to get the employees absence hours, i.e if there are 8 hours in a day and the employee worked for 5:50 minutes then the difference would be calculated in time.... Please also let em know how to calculate absence hours if the working ours are null as its not showing any value for absence column

WorkingHrs    HoursWorked Absencehours

8                       5.10              2.50

8                        Null              Null

I have query that I have written to get the absenceHours= WorkingHrs - HoursWorked

Please help I feel its a simple query but kinda confused with it. Thanks.


Logic to calculate business hours


Hi All,

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.

I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.


Please help me guys... It will be a great help... 

Incremental Crawls take hours randomly


On occasion the incrmental crawls; which usually take under 1 minute take hours to run.

The crawl logs show a successful crawl message and the nothing til it completes, not a single log entry.

It will eventually finish and the next incrmemental will run just fine.

No errors or anything to speak of.

Index has 800K items


User complaining about getting kicked out repeatedly after only a few minutes...


Hi, I am using forms authentication.  My web.config file contains this:

<authentication mode="Forms">
 <forms loginUrl="Login.aspx" defaultUrl="LeaseTracker.aspx" protection="All"   timeout="30" slidingExpiration="true"/>
 <deny users="?"/>

And the login includes this:

FormsAuthenticationTicket formsAuthenticationTicket =
 new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(30),
 _isPersistent, userData, FormsAuthentication.FormsCookiePath);


Response.Redirect(FormsAuthentication.GetRedirectUrl(userName, _isPersistent));

Any ideas on why it would be treating the user this way?

Session Timeout increase to 2 hours.



    for Business needs i am planning to increase the session timeout to 2 hours(120 min) in one application, i am using sql server session state. if i increase to 2 hours of session time out, how it will effect the performance of application and web server.

   Could any one help me on this.






Help! "You must rerun snapshot because current snapshot files are obsolete" every 90 minutes!

I'm having difficulty with SQL Server replication getting machines in the field to replicate correctly.   Here are the specifics of my installation:   100 remote tablet PCs using web sync to update. 1/2 running Vista, 1/2 XP (all latest updates applied) SQL Server Express 2005SP2 w/ cumulative update 6.   Server: Win2003 (all latest updates) SQL Server 2005SP2 CU6   There is 1 database. For each tablet I create a separate publication (PUB001, PUB002, PUB003, etc.) with filtered articles containing data for the tablet. Each publication has a single subscription -- the tablet to which the subscription is assigned. Subscriptions are set to expire after 14 days. Snapshot agent was run when subscription was created, and is set to run automatically every 14 days.     This is a "test" system which is scheduled to roll out into production in 2 weeks.   For the past month I have been running 6 tablets A-OK with no problems (had 6 separate publications/subscriptions on the server/tablets).   I use a stored procedure to create the publications and subscriptions. This stored procedure hasn't changed in months.   Yesterday, we added another 6 tablets w/ separate publications on the server, using the same aforementioned stored procedure.     The tablet application is set to auto-sync over the internet every 15 minutes.   Starting yesterday afternoon, at random, tablets would st

My Sql server 2005 Database in recovery mode for 3 -4 hours every day

Hi , Some of our Sql Server 2005 databases remain in recovery mode after midnight for almost 3 to 4 hours. So when my application access them error "Databse in recovery" and for same database this happens again and again every night. Please suggest why and how this can be solved?

Break apart timespan/duration group by hour segments

I need to break apart a timespan/duration value. I need to calculate the availability of resources by hour of the day. I have a call for service at 0945 that last until 1030 unit = E52 I have a call for servce at 0930 that last until 1015 unit = E53 I have a call for service at 1030 that last unitl 1230 unit = E53 query to show the following % of availabilty for said unit by hour of day 0900 to 1000 available 75% of the time for E52 0900 to 1000 available 50% of the time for E53 1000 to 1100 available 50% of the time for E52 1000 to 1100 avaialble 25% of the time for E53 1100 to 1200 available 0% of time for E53 1200 to 1300 available 50% of the time for E53   all times are actual DTS with dates, hour, minutes, seconds and can transcend past midnight. So in essence I am trying to calculate the availablity of a fire engine in your neighborhood. How often is it our of service on a call by hour of day.   Thanks   Jim

Calculating percentage of sceduled hours

 Hi all,       I 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%         

getting minutes from calculation in gridview

Hi..I have to change the background colour of a calculated field (just the cell not the whole row) in my gridview called ElapsedTime, based on the number of minutes e.g > 30 mins background is red.I have already done something simliar for hours..I have succesfully written a sql statement that calculates elapsed timeCONVERT(Varchar, (DATEPART(dd, GETDATE() - DateAdded)-1) * 24 + DATEPART(hh,GETDATE() - DateAdded)) + 'h:' + CONVERT(Varchar, DATEPART(mi, GETDATE() - DateAdded)) + 'm' AS ElapsedTimeElapsed time looks like this e.g 11h:14mI then used this bit of code to get the hourProtected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound        Dim et As String                ' For Each r As GridViewRow In GridView1.Rows        If e.Row.RowType = DataControlRowType.DataRow Then            et = e.Row.Cells(13).Text            et = et.Substring(0, et.IndexOf("h"))            Dim number As Integer = Int32.Parse(et)            If e.Ro

Expression for 24 hours time and date in SSRS

Hi Guys, What is the expression for  displaying 24 hours time and date in SSRS? Is this the format: =Format(now, "MM/dd/yyyy HH:mm:ss")?Thanks Shiven:)

Forum Subscriptions emails are sent with a delay of 2 hours

Hello I have a couple of forum subscriptions like the ASP.NET MVC forum and I have noticed that when someone creates a new thread that it takes up to 2 hours before I receive the email notification. Can this setting be changed somewhere because I cannot find it in "Edit Profile". Thanks 

Looking for .net people in the USA to talk to on Live Messenger during work hours... talk code.. ide

Im not sure this is the right place to ask but ill give it a try. If theres a better place for this someone let me know please anyways. I am a .NET dev and would love to have a couple people int/adv level .net devs I could IM a question regarding .NET things I am working on.. not 'do this for me please!' questions but Id want to ask more general ways to go about doing things and just conversation fun talk about coding ideas .. I am the only dev at work so it is lonely not having anyone I can ask questions to.. so if anyone would like to chat add me on Live messenger (punkouter@hotmail.com)

Grouping Records into buckets of 15 minutes ....

Hi, Let's say I have a table with the following fields: [Id] [UpdateDate] [Group] Now for one day starting from 00:00:00 to 23:59:59 Let's say I want to plot how many records exist for each group / type in the last day, BUT I want to count these groups in 15 minute intervals. How would I best structure a T-SQL (SQL 2008) query to do this? Example Results: 00:15:00    Group 01 = 211; Group 02 = 289 00:30:00    Group 01 = 205; Group 02 = 233 00:45:00    Group 01 = 200; Group 2 = 267 etc.      I.W Coetzer
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