Visual Basic

  1. Home
  2. Computing & Technology
  3. Visual Basic
Using ADO .NET - More DB Updating - Part 5
2 - ADO .NET: Built for Networks
 More of this Feature
• 1 - Changing Without Wizards
• 3 - A Few Words About Design
• 4 - The CommandBuilder
• 5 - Autonumber Complications
• 6 - The Code and Download
 
 Join the Discussion
Is this the kind of article that helps you?
Let us know!
 
 Related Resources
• Part 1 of the ADO .NET Series
• Part 2 of the ADO .NET Series
• Part 3 of the ADO .NET Series
• Part 4 of the ADO .NET Series
• VB .NET Books!
• New to VB .NET?
  Learn It Here!
 
 Elsewhere on the Web
• About.Com DATABASES
• MSDN Technical Article: CommandBuilder object
 

A key advantage is that this means ADO .NET works great with muli-tiered ('client/server' or 'client/middleware/server') systems -- such as the Internet! After a DataSet is created, your program can disconnect from the actual physical source of the data (the database) and only needs to reconnect once either a change or more data is needed. A DataSet can be thought of as being like a custom database just for your program. There are tables, columns, relationships, constraints, views, and so forth. Changes to the 'real' database are communicated using messages (that is, SQL commands in our case) and this further isolates your program from changes, differences, or even problems (such as the database being taken offline) to the 'real' database.

Our tutorial program, as in previous installments, is not intended to be an example of program design, but rather is intended to help you understand exactly what the ADO .NET objects are doing. For this reason, things like Close and Dispose methods are not called to eliminate a few statements. Only a few Try-Catch blocks have been included ... just as a reminder that you do need them. And the program doesn't even have an Exit function. These things can become very critical in online server based systems, but they don't make much of a difference in a standalone examle like this.

To illustrate add, change, and delete, our example has been modified again to add a button at the bottom and to replace all the Label controls with TextBox controls since we can't insert new text into a Label control. The Two Boolean data items have also been replaced with CheckBox controls. Our new Form looks like this:

Initial Form

Our form is programmed to progress through three functions. First, a new row is added to the database table. Then a row selected in the ListBox can be changed in the database by keying in new values in the TextBox and CheckBox components. Finally, a selected row can be deleted from the database. The caption on the button is changed as the program runs to tell the user which function is next and the first few characters of the caption is used as a flag to control an If program block.

Next page > A Few Words About Design > Page 1, 2, 3, 4, 5, 6

Explore Visual Basic

By Category

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Visual Basic

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.