Creating and Using Strongly Typed DataSet Objects

Create and manipulate DataSets: Create a strongly typed DataSet.

The best way to understand strongly typed DataSet objects is to see what you can do with one syntactically. Suppose you have a normal DataSet object, and you've extracted a DataTable object named dt from this DataSet object. Then you can refer to a value in the DataTable object with any of these syntaxes:

dt.Rows[0][0]
dt.Rows[0]["ColumnName"]

All these syntaxes have one thing in common: They're all late-bound. That is, .NET doesn't know until runtime that ColumnName is a valid column name in the DataTable. By contrast, in a strongly typed DataSet, the columns actually become properties of the row. With a strongly typed DataSet ...

Get MCAD/MCSD Training Guide (70-320): Developing XML Web Services and Server Components with Visual C#™ .NET and the Microsoft .NET Framework 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.