The .NET Framework is based on the common type system, which defines how types are declared, used, and managed in the runtime. It consists of both value types and reference types, which all derive from the Object base type. When working with a data source, the data type is inferred from the data provider if it is not explicitly specified. For example, a DataSet object is independent of any specific data source. Data in a
DataSet is retrieved from a data source, and changes are persisted back to the data source by using a
DataAdapter. This means that when a
DataAdapter fills a DataTable in a
DataSet with values from a data source, the resulting data types of the columns in the
DataTable are .NET Framework types, instead of types specific to the .NET Framework data provider that is used to connect to the data source.
Likewise, when a
DataReader returns a value from a data source, the resulting value is stored in a local variable that has a .NET Framework type. For both the
Fill operations of the
DataAdapter and the
Get methods of the
DataReader, the .NET Framework type is inferred from the value returned from the .NET Framework data provider.
Instead of relying on the inferred data type, you can use the typed accessor methods of the
DataReader when you know the specific type of the value being returned. Typed accessor methods give you better performance by returning a value as a specific .NET Framework type, which eliminates the need for additional type conversion.
Null values for .NET Framework data provider data types are represented by
In This Section
Describes issues that developers frequently encounter when working with floating-point numbers.
SQL Server Data Types and ADO.NET
Configuring Parameters and Parameter Data Types
Retrieving Database Schema Information
Common Type System
ADO.NET Managed Providers and DataSet Developer Center