Skip to content

Add comprehensive MS Access database support documentation and examples#249

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/add-ms-access-reporting
Closed

Add comprehensive MS Access database support documentation and examples#249
Copilot wants to merge 2 commits intomasterfrom
copilot/add-ms-access-reporting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 19, 2025

Overview

This PR addresses the question about MS Access database support in My-FyiReporting. The good news: MS Access support already exists through the OleDb data provider - it just wasn't documented. This PR adds comprehensive documentation and working examples to help users leverage this functionality.

Questions Answered

Q1: "Is it possible to use this tool to create reports based on MS Access data?"

✅ YES - Full support for MS Access databases via the OleDb provider:

  • Access 2007+ (.accdb files) using Microsoft.ACE.OLEDB.12.0
  • Access 2003 and earlier (.mdb files) using Microsoft.Jet.OLEDB.4.0
  • Password-protected databases
  • All standard SQL queries

Note: Windows platform only (OleDb is a Windows technology)

Q2: "Can we change the database location in code?"

✅ YES - Database location can be changed dynamically by building connection strings with different paths. The system is fully flexible for working with databases created on-the-fly.

What's New

📚 Comprehensive Documentation (docs/MS-Access-Database-Support.md)

A complete 17KB guide covering:

  • Platform requirements and installation prerequisites
  • Connection string formats for both .mdb and .accdb files
  • Basic and advanced usage examples
  • Three different approaches for dynamically changing database locations
  • Working with temporary/on-the-fly databases
  • Runtime connection string override for existing reports
  • Troubleshooting guide for common issues
  • Performance considerations and best practices
  • Multiple complete working examples

💻 Working Examples (Examples/AccessExamples/)

Three example files demonstrating real-world scenarios:

  • BasicAccessReport.cs - Simple report generation from Access databases
  • DynamicAccessReport.cs - Multiple approaches for dynamic database selection:
    • Generating reports from multiple different databases
    • User-specified database paths
    • Auto-detecting .mdb vs .accdb format
  • README.md - Quick reference and setup instructions

🔗 Updated Main README

Added clear reference to the MS Access documentation in the main README.md

Quick Example

using Majorsilence.Reporting.RdlCreator;
using Majorsilence.Reporting.Rdl;

// Initialize once per application
RdlEngineConfig.RdlEngineConfigInit();

// Dynamically set database path
string dbPath = @"C:\Data\MyDatabase.accdb";
string connectionString = $@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={dbPath};";

// Generate report
var create = new Create();
var report = await create.GenerateRdl(
    DataProviders.OleDb,
    connectionString,
    "SELECT * FROM Customers",
    pageHeaderText: "Customer Report");

// Export to PDF
var fileStream = new OneFileStreamGen("Report.pdf", true);
await report.RunGetData(null);
await report.RunRender(fileStream, OutputPresentationType.PDF);

Dynamic Database Switching Example

// Process multiple databases on-the-fly
string[] databases = {
    @"C:\Data\Sales2023.accdb",
    @"C:\Data\Sales2024.accdb"
};

foreach (var dbPath in databases)
{
    string connectionString = $@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={dbPath};";
    var report = await create.GenerateRdl(
        DataProviders.OleDb,
        connectionString,
        "SELECT * FROM SalesData",
        pageHeaderText: $"Sales Report - {Path.GetFileNameWithoutExtension(dbPath)}");
    // ... render report
}

Key Features Documented

  • ✅ Both .mdb and .accdb format support
  • ✅ Dynamic database path configuration
  • ✅ Password-protected databases
  • ✅ Creating and reporting from databases on-the-fly
  • ✅ Multiple database reporting in a single application
  • ✅ Relative and absolute path support
  • ✅ Runtime connection string override for existing RDL files

Changes Made

  • Added: docs/MS-Access-Database-Support.md - Complete documentation (479 lines)
  • Added: Examples/AccessExamples/BasicAccessReport.cs - Basic example (154 lines)
  • Added: Examples/AccessExamples/DynamicAccessReport.cs - Dynamic examples (281 lines)
  • Added: Examples/AccessExamples/README.md - Quick reference (77 lines)
  • Modified: Readme.md - Added reference to MS Access documentation (2 lines)

Total: 993 lines added, 0 lines of functional code changed

Testing & Validation

  • ✅ Solution builds successfully (Release configuration)
  • ✅ No functional code changes (documentation and examples only)
  • ✅ Existing test suite results unchanged
  • ✅ No security vulnerabilities introduced
  • ✅ No hardcoded credentials or secrets

Platform Notes

  • Windows: Full support via OleDb provider
  • Linux/macOS: Not supported (OleDb is Windows-only)
    • Alternatives documented: SQLite conversion, ODBC with third-party drivers, or web service approach

Prerequisites for Users

  1. Windows operating system
  2. Microsoft Access Database Engine 2016 Redistributable

Breaking Changes

None - this PR only adds documentation and examples.

Related Issues

Closes #[issue_number] - MS Access database support inquiry

Original prompt

This section details on the original issue you should resolve

<issue_title>ms access</issue_title>
<issue_description>hello,

is it possible to use this tool create reports based ms access data as well?
we create on the fly new databases, can we change as well the location to the database in code?
</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #137


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for reporting based on MS Access data Add comprehensive MS Access database support documentation and examples Oct 19, 2025
Copilot AI requested a review from majorsilence October 19, 2025 19:53
@majorsilence
Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ms access

2 participants