Designed to get programmers up to professional levels as fast as possible, ADO.NET: From Novice to Pro is geared toward developers who have little or no .NET or ADO.NET experience, as well as programmers who are not yet comfortable with database programming. Best-selling author Peter Wright painlessly moves readers from simple database access to the sophisticated manipulation of XML documents.
The book begins by showing you the basic architecture of ADO.NET, and then provides you with the tools you’ll need to work with data providers and the new Connection, Command, and DataSet objects. Wright then drills down into the topics that are essential for you as a professional developer to understand, including transactions, concurrency, typed DataSets, and the use of XML with ADO.NET.
Through numerous hands-on examples and working code that is adaptable to individual projects, you’ll learn how to create fast and powerful ADO.NET enterprise applications. By the end of this book, you’ll be able to work at a professional level utilizing Microsoft’s most powerful data-access technology.
VISUAL STUDIO .NET’S support for the console (text-based output into a DOS-like window) is wonderful. By using the console application templates it’s dead easy to knock out programs to try out ideas, test classes and, of course, focus on learning important concepts. However, in the world of production applications, the GUI is king, whether it’s deployed as part of a desktop application or over the Web using ASP.NET.
In this chapter and the next you’ll look at those two things: using ADO in Windows Forms-based desktop applications and using ADO in Web-based applications. Before going any further, though, I need to evangelize a little, particularly for those of you out there who’ve deployed production applications prior to .NET.
You see, developers are a strange bunch. On the one hand, they all love powerful frameworks, such as .NET, and truly appreciate the amount of work a powerful, well-written framework can save them. On the other hand, there comes a point where a framework can do so much and take so much out of the hands of the programmer that many developers resist its adoption. Sometimes this resistance is well placed. Take Visual Basic, for example (not VB .NET). VB has historically included a number of controls for data binding-binding data from data sources and automatically displaying it on-screen through bound controls. Historically, this always involved something known as a data control. On the surface it looked neat: Stick a data control on a form, bind a number of other GUI controls to the data control, and then at runtime just load some data into the data control and you instantly have a form of data the user can view, update, and navigate, with little or no effort on the part of the developer. This power, though, also took away control from the developer. In earlier versions of VB in particular, developers taking this approach were forced to fight the data control to claw back some degree of control over how the user worked with data, and they inevitably ended up writing more code than if they had just loaded the data and manually populated the controls on the form themselves. The data control was also somewhat inefficient in the way it did things.
For these reasons, there’s a lot of resistance to “bound” user interfaces. Visual Studio .NET and the user interface controls in the .NET Framework support data binding, but it is quite unlike anything you’ve seen before. The decision to use bound controls in .NET is not a decision to forgo control and power in the pursuit of an easy life. The bound controls in .NET do not limit the control programmers have over their data access architecture, and they do not impose unwanted restrictions on the design of the GUI. Bound controls in .NET are incredibly powerful, stunningly easy to use, and if you have experience with prior versions of ADO, DAO, and RDO, you should be pleasantly surprised by just what you can accomplish with them.
In this chapter I’ll lead you through some hands-on examples of common ADO-related GUI tasks. You’ll see how to use a DataGrid, how to use the Visual Studio wizards and designers to create your DataAdapters and Connections with little or no code, and how to data bind any visual control you choose. In the next chapter you’ll drill down in more detail and learn how to take control of data binding through code, and also how to validate and explore data in visual bound controls, again through code.
Download ADO.NET: From Novice to Pro, Visual Basic .NET Edition
The book begins by showing you the basic architecture of ADO.NET, and then provides you with the tools you’ll need to work with data providers and the new Connection, Command, and DataSet objects. Wright then drills down into the topics that are essential for you as a professional developer to understand, including transactions, concurrency, typed DataSets, and the use of XML with ADO.NET.
Through numerous hands-on examples and working code that is adaptable to individual projects, you’ll learn how to create fast and powerful ADO.NET enterprise applications. By the end of this book, you’ll be able to work at a professional level utilizing Microsoft’s most powerful data-access technology.
VISUAL STUDIO .NET’S support for the console (text-based output into a DOS-like window) is wonderful. By using the console application templates it’s dead easy to knock out programs to try out ideas, test classes and, of course, focus on learning important concepts. However, in the world of production applications, the GUI is king, whether it’s deployed as part of a desktop application or over the Web using ASP.NET.
In this chapter and the next you’ll look at those two things: using ADO in Windows Forms-based desktop applications and using ADO in Web-based applications. Before going any further, though, I need to evangelize a little, particularly for those of you out there who’ve deployed production applications prior to .NET.
You see, developers are a strange bunch. On the one hand, they all love powerful frameworks, such as .NET, and truly appreciate the amount of work a powerful, well-written framework can save them. On the other hand, there comes a point where a framework can do so much and take so much out of the hands of the programmer that many developers resist its adoption. Sometimes this resistance is well placed. Take Visual Basic, for example (not VB .NET). VB has historically included a number of controls for data binding-binding data from data sources and automatically displaying it on-screen through bound controls. Historically, this always involved something known as a data control. On the surface it looked neat: Stick a data control on a form, bind a number of other GUI controls to the data control, and then at runtime just load some data into the data control and you instantly have a form of data the user can view, update, and navigate, with little or no effort on the part of the developer. This power, though, also took away control from the developer. In earlier versions of VB in particular, developers taking this approach were forced to fight the data control to claw back some degree of control over how the user worked with data, and they inevitably ended up writing more code than if they had just loaded the data and manually populated the controls on the form themselves. The data control was also somewhat inefficient in the way it did things.
For these reasons, there’s a lot of resistance to “bound” user interfaces. Visual Studio .NET and the user interface controls in the .NET Framework support data binding, but it is quite unlike anything you’ve seen before. The decision to use bound controls in .NET is not a decision to forgo control and power in the pursuit of an easy life. The bound controls in .NET do not limit the control programmers have over their data access architecture, and they do not impose unwanted restrictions on the design of the GUI. Bound controls in .NET are incredibly powerful, stunningly easy to use, and if you have experience with prior versions of ADO, DAO, and RDO, you should be pleasantly surprised by just what you can accomplish with them.
In this chapter I’ll lead you through some hands-on examples of common ADO-related GUI tasks. You’ll see how to use a DataGrid, how to use the Visual Studio wizards and designers to create your DataAdapters and Connections with little or no code, and how to data bind any visual control you choose. In the next chapter you’ll drill down in more detail and learn how to take control of data binding through code, and also how to validate and explore data in visual bound controls, again through code.
Download ADO.NET: From Novice to Pro, Visual Basic .NET Edition