Data Provider for SQL Server (SqlClient)
You can develop Microsoft® Windows® CE-based applications that access databases in Microsoft SQL Server™ version 7.0 or later by using the System.Data.SqlClient namespace. System.Data.SqlClient is the .NET Compact Framework Data Provider for SQL Server. This data provider corresponds to the System.Data.SqlClient namespace of the Microsoft .NET Framework.
Like its counterpart, System.Data.SqlClient in the .NET Compact Framework is a collection of classes that can be used to access SQL Server databases with managed code from Windows CE .NET-based devices.
Unless otherwise noted, all objects in the System.Data.SqlClient namespace match the corresponding objects in the System.Data.SqlClient namespace in the .NET Framework. For more information about the classes in this namespace, see the .NET Compact Framework SDK in Microsoft Visual Studio .NET.
The following lists limitations and exceptions that apply to Windows CE .NET-based devices and the .NET Compact Framework:
- Unsupported classes
SqlClientPermission and SqlClientPermissionAttribute classes are not supported.
- ConnectionString property
Applications using System.Data.SqlClient on Windows CE-based devices may leverage the Windows authentication protocol, instead of using SQL Server authentication. To do this, the connection string must include the following properties:
Property Value Integrated Security SSPI User ID Domain\username Password <password>
In addition, the following ConnectionString properties are not supported: AttachDBFilename, Max Pool Size, Min Pool Size, Connection Lifetime, Connection Reset, Enlist, Pooling, Network Library, and Encrypt.
- ANSI data
ANSI data is supported only for SQL_Latin1_General_CP1_CI_AS collations from an English-based device. All strings in the .NET Framework are Unicode. System.Data.SqlClient converts ANSI data in SQL Server to Unicode using the .NET Framework Encoding classes. Although the Encoding classes are supported in the .NET Compact Framework, not all code pages are.
Also, System.Data.SqlClient cannot read from or write to an ANSI column if the code page for the column is not available on the Windows CE-based device. System.Data.SqlClient generates an error when the code page for an ANSI-to-Unicode conversion is not available.
For information about code pages that are available to a specific Windows CE-based device, contact the device manufacturer.
- Connection pooling
Connection pooling is not supported. A device can only have a small number of connections to an instance of SQL Server at any time.
- Distributed transactions
Distributed transactions are not supported. Transactions cannot span databases or servers. System.Data.SqlClient generates an InvalidOperationException exception during a distributed transaction.
- Net-Library selection
Only TCP/IP connections to an instance of SQL Server are supported. System.Data.SqlClient cannot connect to SQL Server through a device cradle.
- Net-Library encryptions
Encrypted connections to an instance of SQL Server are not supported. If the computer running SQL Server has a Secure Sockets Layer (SSL) certificate installed, the connection will fail.
- Windows authentication
Windows authentication is supported; however, the User ID and Password used for authentication within the Domain Controller must always be specified in the connection string.
For more information, see the System.Data.SqlClient namespace reference in the .NET Compact Framework SDK in Microsoft Visual Studio .NET.