Condividi tramite


SqlCeConnection Class

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Represents an open connection to a data source.

For a list of all members of this type, see SqlCeConnection Members.

System.Object
   System.MarshalByRefObject
      System.Data.SqlServerCe.SqlCeConnection

  [Visual Basic]
  NotInheritable Public Class SqlCeConnection
   Inherits MarshalByRefObject
   Implements IDbConnection, IDisposable

  [C#]
  public sealed class SqlCeConnection : MarshalByRefObject,
   IDbConnection, IDisposable

  [C++]
  public __gc __sealed class SqlCeConnection : public
   MarshalByRefObject, IDbConnection, IDisposable

  [JScript]
  public class SqlCeConnection extends MarshalByRefObject implements
   IDbConnection, IDisposable

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

A SqlCeConnection object represents a unique connection to a data source. When you create an instance of SqlCeConnection, all properties are set to their initial values. For a list of these values, see the SqlCeConnection constructor.

If the SqlCeConnection goes out of scope, it is not closed. You must explicitly close the connection by calling Close or Dispose.

Although SQL Server CE only supports one connection at a time, multiple commands can share the same connection. This means that it is possible to have multiple instances of SqlCeDataReader open on the same connection. This behavior differs from that of System.Data.SqlClient.

If a fatal SqlCeException is generated by the method executing a SqlCeCommand, the SqlCeConnection may be closed. You can reopen the connection and continue.

Requirements

Namespace: System.Data.SqlServerCe

Platforms: .NET Compact Framework

Assembly: System.Data.Sqlserverce (in System.Data.Sqlserverce.dll)

See Also

SqlCeConnection Members | System.Data.SqlServerCe Namespace | SqlCeDataAdapter | SqlCeCommand

Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.

Send comments on this topic.

© Microsoft Corporation. All rights reserved.