Skip to main content

InitConAdapter: Part 2

The second part of the InitConAdapter 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 body of the method to the InitConAdapter stub in PhoneForm.cs.


 ...
   //create UpdateCommand 
   conAdapter.UpdateCommand = cnCache.CreateCommand();
   conAdapter.UpdateCommand.CommandText = updateSQL;
           
   //Add input parameters for UpdateCommand
   AddInputParams(conAdapter.UpdateCommand, "Name", "ContactType", "ID");
            
   //Create DeleteCommand
   conAdapter.DeleteCommand = cnCache.CreateCommand();
   conAdapter.DeleteCommand.CommandText = deleteSQL;

   //Add input parameters to DeleteCommand  
   AddInputParams(conAdapter.DeleteCommand, "ID"); 
}
 
FeedbackOpens in a new tab