conn = new MySqlConnection();cmdGetDate = new MySqlCommand();
try{ conn.ConnectionString = connStringSQL; conn.Open(); ...do some stuff }catch (Exception dbErr){ throw new Exception(dbErr.Message); }finally{ conn.Close(); cmdGetDate.Dispose(); conn.Dispose();}