Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2011, 05:31 PM
Registered User
 
Join Date: Jun 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH 20 Database Controls

I'm not quite sure how to make this question simple. I am an old clipper/dbase programmer trying to get back into database programming using visual basic. It seems to me that the creation of new ways of accomplishing database access are proceeding at warp speed. ADO.net is evolving into LINQ and LINQ is evolving into Entity Framework etc. almost faster than the books can be published. In chapter 20 Rod talks about database access and database controls. In the first part of the chapter Rod describes how to use Visual Studio wizards etc to create connections, datasets, binding sources, and binding navigators. That's pretty cool within 5 minutes I can be viewing data and editing it and I haven't written very much code. Then in the section titled OTHER DATA OBJECTS beginning on page 430 his opening sentence is "If you want a simple program that can display and modify data, then the solution described in the previous sections may be good enough."

I want to learn the method that will allow me to write a complex POS system but I like easy. I don't mind learning to code it myself and in fact I am such a control freak I probably prefer it. What I don't want to do is spend a bunch of time and energy learning an old way of doing something when the simply way of yesterday will be the robust way of tomorrow.

I guess my question is as follows:

Is it necessary to write my own data access code or have the "simple" tools evolved enough that they can be trusted in robust applications and I need to just learn how to use them?

I hope someone can make sense of this.

Thanks
Charles

Last edited by cpfuller; June 29th, 2011 at 05:33 PM..
Reply With Quote
  #2 (permalink)  
Old June 30th, 2011, 11:13 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

I've seen studies that claim 80% or more of all Visual Basic involve a database, and I believe it. Because there's so much market (and money) at stake, Microsoft can't pick something and leave it alone. There have been so many "latest and greatest" database tools over the years that I can't even remember them any more.

I'm a bit of a control freak, too, when it comes to databases so many of the programs I've written don't use the latest easy method. Instead they use connection objects to load data and then process it more directly. It's a bit more work but you get a lot more control over exactly what's happening. If you package the work in nice routines, it's pretty reliable and reusable.

Also the standard solutions tend to have models that don't work well with some of the applications I've worked on. For example, a recordset or dataset takes a snapshot of a big piece of the database. That works okay if you're the only user but can be a problem if there are lots of users working on the same tables. Then you need to build your own synchronization tools. It's not terribly hard to do something like set a field in a record to indicate that a particular user is working on it but things like data binding and Entity Framework don't do it for you.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #3 (permalink)  
Old July 1st, 2011, 06:01 PM
Registered User
 
Join Date: Jun 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default If you don't use datasets what do you use

Rod thanks for responding. If you don't read information from the database into a dataset what do you do. One small app I wrote starts out with a textbox for data input. My code takes that input and builds a query that loads all matching info into a dataset. Example the publisher prefix for wrox in the isbn is 0-470- My program would query my book database returning all records that started with 0-470 which would be all the wrox titles in my database. It loads into a dataset that I can then page through or view in a grid. I'm new to this so I am trying to determine what tools to use were. Thanks again for your time. I do have several of your books they are just not at the house I am staying in.

Thanks
Charles
Reply With Quote
  #4 (permalink)  
Old July 3rd, 2011, 10:50 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

That should work.

Usually I read data into a DataSet or Recordset, I just don't always use data binding to display and edit it. For example, suppose you bind a DataSet to a DataGridView and let the user edit the data there. That works fine if it's a single user system but the changes remain in the DataSet and don't go back to the database until you save all of the changes. If there's more than one user, how do you know you're not making duplicate or conflicting changes to the data?

In that case, I would make the user select a record to edit. Then either use the database's locking mechanism to lock it or add a LockedBy field to the table so the code can "lock" the data logically. That way two users can't edit the same data at the same time. You can also see who has a record locked if you need to.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch. 20 - Compass & Rotations not working sirab33 BOOK: Beginning iOS 4 Application Development 2 June 6th, 2011 11:15 PM
Adapting Ch. 20 code, to create a 'SELECT' DataSet ? liamfitz BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 1 July 7th, 2009 10:56 AM
SQL Express & Ch 20 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 1 August 2nd, 2007 05:16 PM



All times are GMT -4. The time now is 10:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.