Hi,
I am using VS2010. I created s ADO.net Entity data model and try to insert new object to database.
Here is the code.

var cus = new StudentMaster() { studentId =5, studentName = "THA", studentAddress = "GOD" };          
 s.StudentMasters.AddObject(cus);            
 s.SaveChanges();

This didn't give any exception and it worked fine. After insert i load those details into a datagrid and new record is there. but when i check that in the database i can't find that record. Actual Insert object lives only in the memory

Please tell me how to insert it on to the database.

Thanks.

You need to call - SubmitChanges() method of DataContent Class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.