Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7433609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:41:54+00:00 2026-05-29T09:41:54+00:00

I have an MVC3 View that’s posting back a set of input values via

  • 0

I have an MVC3 View that’s posting back a set of input values via Ajax to my controller. My controller is then creating a new FieldTripRoute object on my context and attempting to insert it into the database.

I just can’t figure out what’s going on. I’ve triple checked my Designer schema and my DB schema and they match perfectly. So it can’t be the normal issue of a column not existing or being nullable in one area but not another. However, I keep receiving a “Row Not Found or Changed” exception every time I attempt to submit changes.

The stack trace on the exception looks like this:

   at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
   at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
   at System.Data.Linq.DataContext.SubmitChanges()
   at ManageMAT.Controllers.FieldTripController.RouteAdd(Int32 id, FormCollection collection) 

This is the code that’s being called to add the new Route object from the Controller:

        [HttpPost]
        public ActionResult RouteAdd(int id, FormCollection collection)
        {
            FieldTrip trip = context.FieldTrips.Single(ft => ft.ID == id);

            if (trip == null) return Json(new { success = false, message = "Field trip not found." }); ;

            try
            {

                FieldTripRoute tripRoute = new FieldTripRoute();

                tripRoute.FieldTripID = trip.ID;                
                tripRoute.Date = DateTime.Parse(collection["Date"]);
                tripRoute.ArrivalTime = DateTime.Parse(collection["ArrivalTime"] + " " + DateTime.Now.ToShortDateString());
                tripRoute.DepartureTime = DateTime.Parse(collection["DepartureTime"] + " " + DateTime.Now.ToShortDateString());
                tripRoute.Destination = collection["Destination"];
                tripRoute.PickupLocation = collection["PickupLocation"];
                tripRoute.RouteID = Convert.ToInt32(collection["RouteID"]);           

                context.FieldTripRoutes.InsertOnSubmit(tripRoute);
                context.SubmitChanges();

                return Json(new { success = true, message = "Success!" });
            }
            catch (Exception ex)
            {
                return Json(new { success = false, message = ex.Message });
            }
        }

And here is my Designer and DB Table Columns:

Designer and DB Table Columns

I’ve also attempted to view the SQL this is outputting in both the logging available on the context object and in SQL Profiler, but it seems to be failing before it’s even hitting the Database server.

Edit: Forgot to add one other thing, when I’m initially creating the new FieldTripRoute object at the beginning of the Add action I noticed that it’s not retrieving the correct ID from the database identity series. Perhaps this is related?

I’ve also tried setting the Update Check on every field in the designer to Never just to see if it was some kind of bizarre concurrency collision going on, but I am still receiving the same error.

I’m really at a loss for what could be causing this issue. Any ideas are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:41:56+00:00Added an answer on May 29, 2026 at 9:41 am

    This message is thrown every time the row is not inserted for whatever reason. For DML statements Linq to SQL checks the number of modified rows. SQL Server returns this count. It is checked to be one.

    The big question is why is the count zero and yet no error message is being sent by SQL Server. Start SQL Server profiler and post the SQL that L2S generates. Run the SQL manually and see what happens. Does a row get inserted? Does its identity value get returned?

    Edit: More debugging ahead: Shut down SQL server just before you to the SubmitChanges to make sure that the database is not being hit. Lets make sure to cut this branch off the search tree.

    Next, step into the Linq to SQL source code to see whats up. If you have R# this is easy: Press ctrl-shift-t, search ChangeProcessor, click and navigate to the “sources from symbol files”. Find the function SubmitChanges and put a breakpoint in there. If you don’t have R#, you need to dig out some tutorial on the web for this (it’s going to take about 5min).

    Step through the source to find why the exception is thrown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a view with a JQuery DataTable that loads it's content via AJAX
I have an ASP.NET MVC3 app that features a form with a nested-table input
I have an MVC3 view that's design to run reports for our clients. In
I have an MVC3 application with Razor and I created a View that inside
I have a C#.NET MVC3 web app. I have a View that has a
In my MVC3 application, I have a view model that I Json encode so
I have an MVC3 project I'm working on that has a View with an
Possible Duplicate: Emitting unencoded strings in a Razor view I have a string that
I have a MVC3 site in C#, I have a particular view being fed
I am working on ASP.NET MVC3. I have a partial view RestaurantAdminNavigation.ascx which i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.