You are developing a smart client application. Your code uses a strongly typed DataContext named db to work with a customer table. You use the following code to add a new customer and refresh a data grid with all customers in the table by calling the LoadCustomers method:

Customer cust = new Customer { CustomerID = customerIDToAdd, CompanyName = customerNameToAdd };
db.Customers.InsertOnSubmit(cust);
LoadCustomers(db.Customers);

You find that the newly added customer does not show in the list. You must fix the problem.

What should you do?

 Posted by Rajkatie on 9/13/2012 | Category: ADO.NET Interview questions | Views: 3010 | Points: 40
Select from following answers:
  1. Call SubmitChanges after InsertOnSubmit.
  2. Call Refresh after InsertOnSubmit.
  3. Call the Attach method of the Customer collection.
  4. All Above

Show Correct Answer


Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response