Queries and Resultsets
One of the simplest actions you can perform against a database is to retrieve data from a table. Let's assume you are writing an interface into a Human Resources database and need to retrieve a list of employees' last names from the employee table.
Establishing a Connection
Using ADO.NET, how would you approach this relatively simple task? Normally, the first step is to establish a connection to the desired database. For this example, we make the following assumptions: the HR database we are interested in resides inside a Microsoft SQL Server 2000 database, on a server called HR-DB01. The database itself is called “dbHumanRes,” and the table that holds all the employee records is called “employee.”
We also assume that a ...
Get Visual Basic® Programmer's Guide to the .NET Framework Class Library now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.