Summary

Team Fly 

Page 440

Of course, a real application shouldn't allow the user to enter invalid data in the first place. We're going to build a practical interface for entering orders and invoices in Chapter 18. The example we just finished was merely meant to demonstrate the basic principles of performing multiple updates in the context of a transaction using a DataAdapter.

Summary

In this chapter, which is one of the longest ones on the book, we've explored the basic objects of ADO.NET. The Connection object establishes a connection to the database, through which we can submit and execute commands against the database. The commands to be executed against the database are represented by Command objects. A Command object is assigned the SQL query to execute against the database, as well as the necessary parameters. To actually execute the query, you must call one of the Execute methods of the Command object. Action queries return a single value, which is the number of rows affected by the query. Selection queries return a DataReader object, which you can use to read the values retrieved from the database serially.

You can also use DataAdapter objects, which move data into a client DataSet. Most of the applications you'll write will make use of the DataSet object, which can store sections of database tables and maintain relations between them. The DataSet knows how to submit changes to the database, and you can use it at the client as an in-memory database. As you have seen, DataAdapters and DataSets are classes generated for you at design time. These two classes expose most of the functionality you need for typical business applications. You have also seen how to use these classes to perform the basic data operations, from retrieving a table's rows to performing transactional updates.

In this chapter we used the DataGrid control to view and edit our data. Practical applications aren't built around the DataGrid control, however. They use interfaces based on regular Windows controls and they contain quite a bit of code. In Chapter 18 you're going to see several examples of practical user interfaces, which are based on Windows controls and make use of the objects discussed in this chapter.

Team Fly 


Visual Basic  .NET Power Tools
Visual Basic .NET Power Tools
ISBN: 0782142427
EAN: 2147483647
Year: 2003
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net