C .NET Classes : SQL Server Data Provider Classses

SQL Server Data Provider Classses
The SQL Server data provider supports the public classes, properties, and methods as described in the Microsoft .NET Framework SDK documentation. The SQL Server data provider attaches the provider-specific prefix SQLServer to the public .NET class, for example, SQLServerCommand.
This section describes the provider-specific properties and methods of the SQL Server data provider.
SQLServerBulkCopy Class
The SQLServerBulkCopy class uses a model similar to the ADO.NET Bulk API patterns, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerBulkCopyColumnMapping Class
The SQLServerBulkCopyColumnMapping class uses an API pattern similar to the Microsoft SqlBulkCopyMapping class, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerBulkCopyColumnMappingCollection Class
The SQLServerBulkCopyColumnMapping class follows an API pattern similar to the Microsoft SqlBulkCopyColumnMappingCollection class, and has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerCommand Class
Table C-29 lists the provider-specific public properties of the SQLServerCommand class. The table includes the generic public properties of the Command class when provider-specific information supplements the standard descriptions. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
SQLServerCommandBuilder Class
Using a CommandBuilder class can have a negative effect on performance. Because of concurrency restrictions, the CommandBuilder can generate highly inefficient SQL statements. The end-user can often write more efficient update and delete statements than those that the CommandBuilder generates.
The SQLServerCommandBuilder class has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerConnection Class
Table C-30 lists the provider-specific public properties of the SQLServerConnection class. Some properties return the values specified for the corresponding connection string option. See “Connection String Options” for more information. For a description of other properties supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
See “Using Reauthentication” for a description of OS authentication in a connection pool.
See “Performance Considerations” for a discussion of the performance implications of the value set for this property.
Table C-31 lists the provider-specific public methods of the SQLServerConnection class. For a description of other methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
SQLServerConnectionStringBuilder Class:
The SQLServerConnectionStringBuilder class has no provider-specific methods. For information about the methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerConnectionStringBuilder property names are the same as the connection string option names of the SybaseConnection class. However, the connection string option name has spaces between the words. For example, the connection string option name Alternate Servers is equivalent to the property name AlternateServers.
See “SQL Server Data Provider Connection String Options” for the connection option descriptions, which are listed alphabetically by the connection string option name. The ConnectionStringBuilder property name is listed immediately underneath the GUI name.
SQLServerDataAdapter Class
Table C-32 lists the provider-specific implementation of the public properties of the SQLServerDataAdapter class. For information about other public properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
SQLServerDataReader Class
The SQLServerDataReader class has no provider-specific public properties or methods. For a description of the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerError Class
Table C-33 lists the provider-specific public properties of the SQLServerError class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerErrorCollection Class
Table C-34 lists the provider-specific public properties of the SQLServerErrorCollection class. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
SQLServerException Class
Provider-specific exceptions are derived directly from the System.Data interface. Only the public properties and methods, for example, the Message property, are directly available on the System.Exception object in a generic sense. The SQLState and Number properties are only accessible through provider-specific code or by using reflection.
Table C-35 lists the provider-specific public properties of the SQLServerException class. The properties apply to the last error collected if multiple errors occurred. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
 
SQLServerFactory Class
Provider Factory classes allow users to program to generic objects. Once instantiated from DbProviderFactory, the factory generates the proper type of concrete class.
Table C-36 lists the static methods used to accommodate choosing the SQL Server data provider and instantiating its DbProviderFactory.
 
SQLServerInfoMessageEventArgs Class
The SQLServerInfoMessageEventArgs object is passed as an input to the SQLServerInfoMessageEventHandler and contains information relevant to a warning generated by the SQL Server server.
The SQLServerInfoMessageEventArgs object has no provider-specific properties or methods. For information about the properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
SQLServerParameter Class
Table C-37 lists the provider-specific public properties of the SQLServerParameter class. The table includes the generic public properties of the Parameter class when provider-specific information supplements the standard descriptions. For information about other properties and methods supported, refer to the data provider’s online help and the Microsoft .NET Framework SDK documentation.
NOTE: When executing a stored procedure, the data provider by default assumes that the parameters supplied are in the same order as they were specified in the Create Procedure statement. The names of parameters supplied in the SQLServerParameter object are ignored.
 
This property is specified as an array of values when array binding is enabled (see the ArrayBindCount property of the “SQLServerCommand Class”). Each array's length must match the value of the ArrayBindCount property. When specifying the array's values for binary type columns, the data will actually be specified as byte[]. This is an array of arrays of bytes. The data provider anticipates a jagged array as such when using parameter array binding with parameters.
SQLServerParameterCollection
Table C-38 lists the provider-specific public properties of the SQLServerParameterCollection class. For information about other properties and methods supported, refer to the data provider’s online help.
 
SQLServerTrace Class
The SQLServerTrace class is created by the application to debug problems during development. Setting the properties in the SQLServerTrace class overrides the settings of the environment variables (see “Connection String Options”). For your final application, be sure to remove references to the SQLServerTrace class.
The following code fragment creates a SQLServerTrace class with a trace file named MyTrace.txt. All subsequent calls to the data provider will be traced to that file.
SQLServerObject.TraceFile="C:\\MyTrace.txt";
SQLServerObject.RecreateTrace = 1;
SQLServerObject.EnableTrace = 1;
Table C-39 lists the public properties for the SQLServerTrace class.
 

1
Setting EnableTrace starts the tracing process. Therefore, you must define the property values for the trace file before setting EnableTrace. Once the trace processing starts, the values of TraceFile and RecreateTrace cannot be changed

Table C-40 lists the public methods for the SQLServerTrace class.
 
SQLServerTransaction Class
The SQLServerTransaction class has no provider-specific public properties or methods. For a description of the properties and methods supported, refer to the online help and the Microsoft .NET Framework SDK documentation.