InitConAdapter : パート 2
InitConAdapter のパート 2 では以下の作業を行います。
-
アダプタの Update コマンドを作成します。
-
AddInputParams ヘルパー・メソッドを使用して、入力パラメータを Update コマンドに追加します。
-
アダプタの Delete コマンドを作成します。
-
AddInputParams ヘルパー・メソッドを使用して、入力パラメータを Delete コマンドに追加します。
このメソッドの本文を、PhoneForm.cs の InitConAdapter スタブに追加します。
...
//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");
}