Skip to main content

AddInputParams

In order to avoid a lot of repetitive code, PhoneForm.cs provides the AddInputParams method. This method creates CacheParameter objects and adds them to their CacheCommand objects. The method is restricted in the types of CacheParameter objects it creates. Here are the restrictions:

  • It only creates Input parameters.

  • It only creates parameters of type NVARCHAR.

  • It only creates parameters that contain data with fifty characters or fewer.

Here is the method:


private void AddInputParams(CacheCommand cmd, params string[] cols)
 {
  foreach (String column in cols)
   {
     cmd.Parameters.Add(column,CacheDbType.NVarChar,50,column);
   }
}

FeedbackOpens in a new tab