Thread: Question Populating combobox
View Single Post
  #9 (permalink)  
Old 10-22-2008, 6:16 AM
cjard's Avatar
cjard cjard is offline
VB.NET Forum All-Mighty
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Apr 2006
Age: 64
Posts: 5,375
Reputation: 539
cjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalistcjard VB.NET gold medalist
Default

Avoid the outdated tutorials. Right now youre writing Bad Code (TM) from an OO point of view because youre basically mashing all your code into one place. A button click event handler is NOT the place to be preparing an SQL statement and running it against a DB.

You'll also be amazed at how much hard work youre making for yourself, and tbh, it isnt even helpful or teaching you good things because (while i'm all for a "Make noobs program in Notepad so they appreciate visual studio" approach) all you end up doing is pick up baaad habits because everyone else does it too.

An arguemnt I usually use to sway people is:
Do you use the forms designer to make your forms and set your properties, or do you code all the layout stuff by hand? You bet you use the forms designer.. So a database access layer designer exists that generates great, modular, fast, working, safe code in seconds.. Why do you let it rest idle, and carry on writing your SQLs by hand, in a bad, slow, unsafe, poor-OO way?
Usually the answer is "because I don't know how to use it"

..and that's what DW2 is for..

In a little over the time it takes you to write the SQL to get your prefs value, i'll have a fully working code that prepares a statement, connects the db, retrieves the value, shuts everything down gracefully and returns me the value in type safe form.. I'll use it in one line too, making my code neater and more modular and reusable. What's to lose? Check it out.. No harm in using a wizard if it does a better job in seconds than most humans can do in a hour or more
__________________
"it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ
Reply With Quote