Benefits of DataBinding for Manual Query / Add to Control

I was a C # programmer for about 2 years and professionally worked a little more than 1. I work in the company as a developer in an application that started before the days of .NET 2. My question is as follows:

What is the advantage of using data binding from sql queries directly to query management and manually adding elements to the control? Is this approach generally considered cleaner and easier to deploy? Are there more cases where adding manually will give finer-grained control over the display / value of the data?

I ask because I have been assigned some errors that relate to some controls that populate themselves based on the results of the query and would like to clear the unnecessary logic and push it to the libraries that will handle instead of me.

Note. We are using .NET 2.0

+4
source share
5 answers

I personally believe that with

control.DataSource = YourSource; control.DataBind(); 

the process is much simpler, you do not need to iterate and generally reduces LOC.

When working with DropDownLists and other controls, you will most likely also set the DataValueField and DataTextField properties.

+5
source

Data binding is much easier to set up, less error prone, significantly reduces LOC (as Mitchell Sellers said), and a few minor glitches work quite reliably.

In my experience, you really need full manual control if you need to specify the exact update order or synchronization of data-bound controls.

+1
source

Connecting information is much easier to set up, a less problematic subject as a whole significantly reduces LOC and, in some modest errors, will work quite easily. In my experience, in fact you only need a complete guide if you need to indicate the actual updated order or time to get information about some pens.

+1
source

It may be useful to manually bind if you have a complex input script. Using the data entry controls, you can find that you only know that you have bad data when it gets into the database and throws an exception (poorly formatted date / time, integer from the correct range, etc.).

Obviously, you can handle this with various validation / pre-commit events in data controls, but it might be easier (and more obvious to read) to simply manually confirm your entry and publish it when you know it correctly.

This is the only reason I can think of, and it is applicable only for input. If you are in read-only mode, data binding does not require much effort.

0
source

My experience was completely opposite to my previous posters here. This blog post (dated 2006) summarizes my feelings about data binding.

0
source

All Articles