SqlCeConnection.SqlCeConnection() Constructor
Initializes a new instance of the SqlCeConnection class.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
Syntax
'Declaration
Public Sub New
'Usage
Dim instance As New SqlCeConnection
public SqlCeConnection ()
public:
SqlCeConnection ()
public SqlCeConnection ()
public function SqlCeConnection ()
Not applicable.
Remarks
When a new instance of SqlCeConnection is created, the read/write properties are set to the following initial values unless they are specifically set by using their associated keywords in the ConnectionString property.
Properties |
Initial Value |
---|---|
ConnectionString |
empty string ("") |
empty string ("") |
You can change the value for these properties only by using the ConnectionString property.
Example
The following example creates and opens a SqlCeConnection.
Dim conn As New SqlCeConnection()
' Set some connection string properties e.g.:
'
conn.ConnectionString = _
"Persist Security Info = False; Data Source = 'SalesData.sdf';" & _
"Password = '<password>'; File Mode = 'shared read'; " & _
"Max Database Size = 256; Max Buffer Size = 1024"
conn.Open()
' You can change the database while preserving
' the orignal connection options
'
conn.ChangeDatabase("SupportData.sdf")
SqlCeConnection conn = new SqlCeConnection();
// Set some connection string properties e.g.:
//
conn.ConnectionString =
"Persist Security Info = False; Data Source = 'SalesData.sdf';" +
"Password = '<password>'; File Mode = 'shared read'; " +
"Max Database Size = 256; Max Buffer Size = 1024";
conn.Open();
// You can change the database while preserving
// the orignal connection options
//
conn.ChangeDatabase("SupportData.sdf");
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Framework
Supported in: 3.0
.NET Compact Framework
Supported in: 2.0, 1.0
See Also
Reference
SqlCeConnection Class
SqlCeConnection Members
System.Data.SqlServerCe Namespace