Export (0) Print
Expand All

SqlCeConnection Constructor

Initializes a new instance of the SqlCeConnection class.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

public SqlCeConnection()

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.


Initial Value


empty string ("")


empty string ("")

You can change the value for these properties only by using the ConnectionString property.

The following example creates and opens a SqlCeConnection.

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";


// You can change the database while preserving 
// the orignal connection options

© 2014 Microsoft