I am about to write a multitude of back-end C# methods for my webpage To update data in a database from 17 controls on my page itself.
Just before I write 17 Methods to handle a update procedure towards my database, I would like to know if it would be more efficient to write 1 huge method to handle all my update scripts for all the controls of my webpage? I am going to use the SQLConnection Object together with SQLCommand to achieve this.
What I am trying to prevent is long-running queries in my webpage because of too many methods (if that is even possible)
By default, If my controls are left empty, no corresponding data (like the Title of a career) in my table within the database must change.
So would it be better to write 17 different methods for my 17 controls? or to Write 1 large validation method to Search through every control’s contents and running an update script afterwards?
A little clarification
These 17 methods that I wanted to write for each control will only be called if the corresponding control does not have its default value (so if textbox 5 is empty, then textbox 5’s Update method won’t be called).
It’s probably worth making sure it’s only one database call, but whether it’s one method or 17 will make no significant difference at all, if the two approaches actually do the same thing. There may be an insignificant difference, but the time spent talking to the database is going to dwarf anything else.