When I enter an incorrect database in the above code, the catch part catches the error but does not close the application. a simple error, but could not solve.
OleDbConnection conn;
string connectionString = "Provider=Microsoft.ACE.Oledb.12.0; Data Source=xx.accdb";
public void connect()
{
conn = new OleDbConnection(connectionString);
try
{
this.conn.Open();
}
catch(Exception)
{
MessageBox.Show("Error.");
Aplication.Exit();
}
}