CommitChanges is method of DataContext - LINQ

Q.  Which of the following statement / s is / are true?
- Published on 31 Aug 15

a. CommitChanges is a method of SqlDataContext.
b. CommitChanges is a method of DataContext.
c. CommitChanges is a method of DbDataContext.
d. CommitChanges is a method of OleDbData Context

ANSWER: CommitChanges is a method of DataContext.
 
In LINQ, CommitChanges is a method of DataContext class. DataContext class is used to connect with database, retrieve objects from it, and submit changes back to it.
Example:
DataContext context = new DataContext( “ Provide your connection string ” );
You can also create and delete database as given below.
Create database
context.CreateDatabase();

Delete database
context.DeleteDatabase();

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)