Skip to main content

InitPhoneAdapter: Part 2

The second part of InitPhoneAdapter does the following:

  1. Creates the Update command for the adapter.

  2. Adds the input parameters to the Update command using the AddInputParams helper method.

  3. Creates the Delete command for the adapter.

  4. Adds the input parameters to the Delete command using the AddInputParams helper method.

Add the method body to the InitPhoneAdapter stub in PhoneForm.cs.


...
 //Create UpdateCommand
 phoneAdapter.UpdateCommand = cnCache.CreateCommand();
 phoneAdapter.UpdateCommand.CommandText = updateSQL;

 //Add input parameters for UpdateCommand
 AddInputParams(phoneAdapter.UpdateCommand, "Number", "PhoneNumberType", "ID");

 //Create DeleteCommand
 phoneAdapter.DeleteCommand = cnCache.CreateCommand();
 phoneAdapter.DeleteCommand.CommandText = deleteSQL;

 //Add input parameters for DeleteCommand
 AddInputParams(phoneAdapter.DeleteCommand, "ID");
 }

FeedbackOpens in a new tab