using System; using System.Data.OleDb; class TestDbAccess { static void Main() { string dbPath = @"C:\GEVISOFT\DATABASE\GeViDB.mdb"; // Try different connection strings string[] connectionStrings = { $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={dbPath};", $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={dbPath};Mode=Read;", $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={dbPath};Mode=Share Deny None;", $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={dbPath};", }; foreach (var connStr in connectionStrings) { try { Console.WriteLine($"\nTrying: {connStr.Substring(0, Math.Min(60, connStr.Length))}..."); using (var conn = new OleDbConnection(connStr)) { conn.Open(); Console.WriteLine("[OK] Connected successfully!"); // Try to list tables var schema = conn.GetSchema("Tables"); Console.WriteLine($"[OK] Found {schema.Rows.Count} tables"); // Try to query Alarms table using (var cmd = new OleDbCommand("SELECT COUNT(*) FROM Alarms", conn)) { var count = cmd.ExecuteScalar(); Console.WriteLine($"[OK] Alarms table has {count} records"); } conn.Close(); Console.WriteLine("[OK] This connection string works!"); return; } } catch (Exception ex) { Console.WriteLine($"[ERROR] {ex.Message}"); } } Console.WriteLine("\n[FAILED] None of the connection strings worked."); } }