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