Click here to Skip to main content
12,299,947 members (53,713 online)

.NET Framework

 
GeneralRe: Run through loop for week and dont select weekends Pin
xnaLearner10-Dec-12 4:52
memberxnaLearner10-Dec-12 4:52 
GeneralRe: Run through loop for week and dont select weekends Pin
Pete O'Hanlon10-Dec-12 4:53
protectorPete O'Hanlon10-Dec-12 4:53 
QuestionDeploying a Windows Service Pin
indian14310-Dec-12 4:09
memberindian14310-Dec-12 4:09 
AnswerRe: Deploying a Windows Service Pin
Pete O'Hanlon10-Dec-12 5:04
protectorPete O'Hanlon10-Dec-12 5:04 
GeneralRe: Deploying a Windows Service Pin
indian14310-Dec-12 5:08
memberindian14310-Dec-12 5:08 
GeneralRe: Deploying a Windows Service Pin
Pete O'Hanlon10-Dec-12 5:20
protectorPete O'Hanlon10-Dec-12 5:20 
Questionrun through startDate to endDate and add each record to DB Pin
xnaLearner10-Dec-12 2:04
memberxnaLearner10-Dec-12 2:04 
AnswerRe: run through startDate to endDate and add each record to DB Pin
xnaLearner10-Dec-12 2:35
memberxnaLearner10-Dec-12 2:35 
I've updated my code to:
[HttpPost]
public ActionResult listHolidays(Holiday holiday, int? PersonId, string HolidayDate, string endDate)
    {
        DateTime startDates = Convert.ToDateTime(HolidayDate),
                 endDates = Convert.ToDateTime(endDate);
 
        while (startDates < endDates)
        {
            startDates.AddDays(1);
            db.Holidays.AddObject(holiday);
            db.SaveChanges();
        }
 
        return RedirectToAction("Index");

however I debugged using breakpoint, it runs through the loop once but on the second attempt it stops at db.Holidays.Addobject(holiday);

and I receive the error: An object with the same key already exists in the ObjecttateManager. the existing objects is in the unchanged state. An ibject can only be added to the objectStateManager again if it is i the added state.

if anyone can help that would be great
QuestionASP.NET Post Textbox After Button Click Pin
xnaLearner9-Dec-12 11:15
memberxnaLearner9-Dec-12 11:15 
AnswerRe: ASP.NET Post Textbox After Button Click Pin
Richard MacCutchan9-Dec-12 21:54
mvpRichard MacCutchan9-Dec-12 21:54 
GeneralRe: ASP.NET Post Textbox After Button Click Pin
xnaLearner10-Dec-12 0:14
memberxnaLearner10-Dec-12 0:14 
Question.netframework Pin
zofi518-Dec-12 4:30
memberzofi518-Dec-12 4:30 
AnswerRe: .netframework Pin
Dave Kreskowiak8-Dec-12 6:37
mvpDave Kreskowiak8-Dec-12 6:37 
AnswerRe: .netframework Pin
Eddy Vluggen8-Dec-12 7:18
memberEddy Vluggen8-Dec-12 7:18 
GeneralRe: .netframework Pin
Kevin Bewley13-Jan-13 23:46
memberKevin Bewley13-Jan-13 23:46 
AnswerRe: .netframework Pin
jibesh11-Dec-12 10:36
memberjibesh11-Dec-12 10:36 
QuestionEnter 3 dates and display order in different VIEW, after click Pin
xnaLearner7-Dec-12 9:52
memberxnaLearner7-Dec-12 9:52 
Question[VB.NET 2008] How to detect if a page of a TabControl is selected (Windows CE) Pin
steve_94966136-Dec-12 21:37
membersteve_94966136-Dec-12 21:37 
AnswerRe: [VB.NET 2008] How to detect if a page of a TabControl is selected (Windows CE) Pin
Zaf Khan10-Dec-12 17:57
memberZaf Khan10-Dec-12 17:57 
GeneralRe: [VB.NET 2008] How to detect if a page of a TabControl is selected (Windows CE) Pin
steve_949661311-Dec-12 21:20
membersteve_949661311-Dec-12 21:20 
GeneralRe: [VB.NET 2008] How to detect if a page of a TabControl is selected (Windows CE) Pin
Zaf Khan12-Dec-12 2:13
memberZaf Khan12-Dec-12 2:13 
Question[VB.NET 2008] How to get control on objects created at runtime Pin
steve_94966135-Dec-12 4:54
membersteve_94966135-Dec-12 4:54 
AnswerRe: [VB.NET 2008] How to get control on objects created at runtime Pin
Eddy Vluggen5-Dec-12 5:40
memberEddy Vluggen5-Dec-12 5:40 
GeneralRe: [VB.NET 2008] How to get control on objects created at runtime Pin
steve_94966135-Dec-12 20:59
membersteve_94966135-Dec-12 20:59 
GeneralRe: [VB.NET 2008] How to get control on objects created at runtime Pin
Eddy Vluggen6-Dec-12 2:27
memberEddy Vluggen6-Dec-12 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 25 May 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid