I am working on a page which display a gridview of members in a household. There are also other inputs for the entire household and one button at the bottom of the page that is intended to save the changes, or insert a new household depending on the situation. The number of rows is dynamic and the user can add and remove displayed rows. This is fine for a new household, but on an existing one I need it to delete the member from the household. I can do this easily right away, but I'm wondering if there is a way I can save or store the pending changes, basically the deleteonsubmit, insertonsubmit, and updates, till I call the submitchanges method when the user clicks save. That way if they change their mind about the changes, say the delete a member or an income they
I have an ASP.NET MVC view. I want the view to load and then do a post using ajax to load some secondary content. I know the Ajax.ActionLink methods etc. but I want the post to happen automatically when the page is loaded. And not based on some user action.
I have a couple of tables I ported over to a new database. Everything is exactly the same from the legacy one to the new one. The back-end code that submits the user generated data to the database is also the same. When I submit changes to the database, all of the submitted information populates the correct columns but the column that stores the GUID populates with all 0's. When I enter in the columns manually using SQL Server Management Studio, the GUID gets populated as it does in the legacy version.
In my 2nd ASP.NET MVC project I'm facing a very weird problem: when I call the SubmitChanges method of the DataContext class, nothing updates in the database. It's weird because everything works fine with my first project. I'm using a remote database created in Sql Server Management Studio, I tried doing some queries there and in Visual Studio 2010 (where I have the connection to the database), they all work. Where might the problem be hidden?
DBDataContext DB = new DBDataContext(); var myuser = DB.Users.Single(u => u.ID == id); myuser.Age = 45; DB.SubmitChanges();
This is embarrassing :D Indeed I didn't have a primary key. Now it works!
I am running through this tutorial on ASP.NET MVC: [URL] Everything seemed to be going fine. I created my DB, created my Model classes, created a controller class and then started creating some Action handlers. When I finally created the page that submits updates to the DB, I got the following error:
System.NotImplementedException: The method or operation is not implemented.
Line 49: public void Save()Line 50: {Line 51: db.SubmitChanges();Line 52: }
when I call the "SubmitChanges()" method of the DataContext class. I tried recreating my DBML file from my tables, but I still get the same error.
The ASP.NET linq SubmitChanges method commits changes for all previous database modifications since the last time it was called.
I have a case where I do something like the following:
ClassX x = new Abc.Linq.ClassX(); DataContext.InsertOnSubmit(x); ClassY y = new Abc.Linq.ClassXY(); DataContext.InsertOnSubmit(y);
DataContext.SubmitChanges();//x and y are committed to the database
I would like to insert y but not X in the line above. Then I would like to insert X with another call to SubmitChanges() sometime later. I have to execute the code in the order shown.
I was trying to delete records from database and sometimes on production, the SubmitChanges() goes through and updates the associated entities yet the data does not gets deleted in the database.This is happening only in production and I could not replicate the same on stage or on my local machine. Now the table in which I am performing the delete transaction does have primary keys.
I am working on a content management system which is being sort of retrofitted onto an existing database, and the database has many many tables. There will be a staging database, where we will make changes and allow users to 'preview in place'. Then any changes have to be approved, and to publish them we will connect to a live version of the same database (same schema) and play-forward the captured changes.I have found some code (called Doddle Audit) which, with some customization, is giving me great information about what is changing. I am able to get a list of all columns, before and after, for updates, inserts, and deletes. But what I would really like to have is the underlying SQL being run by SubmitChanges(). LinqToSql has to generate this, so why can't I have it? I have googled around and looked at code involving SubmitChanges, mousing over stuff, and I can't seem to find it. Does anyone know of a way to obtain this?
I'm got 2 model objects. Category and CategoryItem. I try to add a CategoryItem to Category in my Controller but It wont save to database, and I know why because I don't know how to call the submitChanges on the add while using repository, I dont got the DBContext right there is you know what I mean?.. here I will show you with code.
want to know if linq to sql auto updated the id column of a class (table row object) after SubmitChanges is called inserting a new row to that table, that would be fantastic, would anyone be able to confirm this?
I am confused about why I would need to wrap the DataContext's SubmitChanges within a transactionScope when modifying multiple tables. I was under the impression that the DataContext would track these changes and would therefore create its own transaction if need be.
In other words, if a change was made to update table A, B and C or if I made changes to 10 out of 20 items in a collection of rows, that the datacontext would track these changes and create its own transaction. If that is correct then why have I seen examples that wrapped these types of updates in a TransactionScope?