tags:

views:

80

answers:

2

hi

I've started learning data source controls

To my understanding, the only benefits of using data source controls instead of using regular data binding are the following:

  • you don’t have to write data access logic (thus you don’t have to create SqlCommand, SqlConnection etc, and you also don’t have to create Datareader or DataSet)

  • you are able to see in VS designer what columns will select query produce

  • you can bind parameters to other controls

a) Are there any other benefits of using data source controls?

b) As for data source controls relieving you of the tedious task of writing data access logic: Don’t data source controls in fact spare you of writing 10 lines of code at max? Is that really so beneficial or am I again missing something quite obvious?

bye

A: 

My normal use of the "data source" bits is to more quickly set up my grids and forms. Once done, I will bind using other methods, as I do not want two artifacts that are common to the drag and drop UI:

  1. Munging of all layers into one control
  2. Reliance on extra FUD to keep the app working

But, using the data source to set up UI? Yeah, that is pretty cool. Outside of the box? Certainly. :-)

I am a big fan of drag and drop to do the mundane, but I am not fond of something that holds me inside a box.

Gregory A Beamer
A: 

On the benefits listed:

"thus you don’t have to create SqlCommand, SqlConnection etc" - linq2sql, entity framework, or [insert a good ORM here] are much better to help you on this. Say you want to display a of Companies with their top 3 employees in a ListView, using a plain old sql query doesn't play so well to get it up quickly (and working right i.e. not hitting the database separately to get top 3 employees for each company you are displaying)

On additional benefits: You can tell it to cache right there

On comparing it to the tedious task of writing data access logic: see above :)

Ps. My personal opinion is that it certainly pushes you to a pattern where the code is more tied up to the UI. I kept the answer on the points that address the question more directly.

eglasius
thank you all for your help
glad to help, btw, thx are given around here with vote and accept :)
eglasius
I though about giving the accept, but since you've all more or less helped, wouldn't choosing just one suggest other two didn't help?And I thought for voting you must be registered( uh, that's complicated )?
If you have a google/yahoo/flickr/[other with open id support] account you can use that, check http://stackoverflow.com/users/login
eglasius