Strongly Typed DataSets

Over the past three chapters, you’ve learned how to create and use DataSet objects. The code used to access the contents of a DataSet is programmatically similar to code for accessing earlier objects such as the ADO and DAO Recordset objects, as you can see by comparing the following examples:

ADO.NET and Visual Basic

Dim strCompanyName As String
strCompanyName = CStr(tblCustomers.Rows(0)("CompanyName"))

ADO.NET and Visual C#

string strCompanyName;
strCompanyName = (string) tblCustomers.Rows[0]["CompanyName"];

ADO, DAO, and Visual Basic "Classic"

Dim strCompanyName As String
strCompanyName = rs.Fields("CompanyName").Value

Developers have been writing this kind of code since the early days of Visual Basic. Technically, there’s ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition 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.