encountering a problem while I update an entity fields and want to save it back to database. I am using Entity Framework as DAL and have designed a Repository to access the Entity objects.
Database will show that a record has been saved but if I want to update the record it will not show the new data. *InvoiceGeneratorEntities context = new InvoiceGeneratorEntities(); * *var test = context.CompanyInformation.First(); * *test.ContactName = "123"; context.AcceptAllChanges(); * *context.SaveChanges(); //retrieve var test1 = context.CompanyInformation.First(); * *MessageBox.Show(test1.ContactName); * if we assume I have a CompanyInformation Entity the above code will not change its state. On Thu, Nov 11, 2010 at 7:29 PM, Stephen Russell <srussell...@gmail.com>wrote: > On Wed, Nov 10, 2010 at 11:23 AM, Santhosh V Kumar > <santhosh.vku...@gmail.com> wrote: > > Hi all, > > Today I am trying to do Update the value of a particular row > > with LINQ but I am finding the but can some one please help me to get > > ride of this. Here is my code > > > > DataClasses1DataContext db = new DataClasses1DataContext(); > > login log = db.logins.Single(p => p.uname == "san"); > > log.pword = TextBox1.Text; > > log.logi = TextBox2.Text; > > db.SubmitChanges(); > > > > > > no changes gets affected in table. > ------------------------------ > > db.SaveChanges() is what you need. > > > -- > Stephen Russell > > Sr. Production Systems Programmer > CIMSgts > > 901.246-0159 cell > -- Regards Manish Mhatre 9076417538