CommitChanges is method of DataContext - LINQ
Q. Which of the following statement / s is / are true?- Published on 31 Aug 15a. 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();