Immediate Connection Close

Listing 2.

private void Form1_Load(object sender, EventArgs e)
{
// Build the connection string
String connectString = String.Format(@"DataSource={0}\DBExample.sdf", AppPath());
// Open a connection to the database
using (_connection = new SqlCeConnection(connectString))
{
_connection.Open();
// Use the connection here
}
}