各テキストボックスのコードを入力せずにforeachを使用して、フォーム内のすべてのテキストボックスをクリアできます。
com.Parameters.Add(new SqlParameter("@",objPlayrInjr_P));
using (SqlCommand com = new SqlCommand())
{
com.CommandText = "SPname";
com.Connection = connection object;
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add(new SqlParameter("@SqlParameterName",objectName.propertyName));
}
テキストボックスをクリアするときのように、ループを介してオブジェクトsqlParameters
に追加するメソッドが必要です。Command
したがって、ステートメントごとにコードを記述する必要はなく、ループによって実行されます。