I have a form that has multiple text boxes, check boxes etc...
The question is, instead of writing out:
cmd.Parameters.Add(new SqlParameter("@myparam", (object)textbox.Text));
a million times for each parameter, is it possible to load all of the names of the objects on a form into an array and just do a loop through those names to set the parameters?
I tried using something similar to:
cmd.Parameters.Add(new SqlParameter("@" + array.GetValue(cnt).ToString(), (object)array.GetValue(cnt).Text));
but for obvious reasons...it fails. Any suggestion? Instead of an array that I populate maybe a system array works that would get the object names off of the form? I dunno...