Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6133433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:13:41+00:00 2026-05-23T17:13:41+00:00

VS 2008 / C# / MS Access 2003 / 2007 I have attached Code

  • 0

VS 2008 / C# / MS Access 2003 / 2007

I have attached Code Snippet which throws exception on Release Mode. In Debug Mode, Application works great.

In order to test this piece of code, I moved to Console Application. When ever I run the application, it shows MS Access DB is already in Use.

So, before executing this piece of code, I need to Kill MS Access DB Process. Whether it is in use or not, I need to kill all the buffer process.

How should I kill the process before I execute this piece of code ?

try
    {

        Access.Application access1 = new Access.Application();

        // Open the Access database for exclusive access
        string sSalisburyAccessDB = Server.MapPath("~/App_Data/Salisbury.mdb");

        access1.OpenCurrentDatabase(sSalisburyAccessDB, true, null);

        // Drop the existing table data

        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "drug");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "patplan");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "plans");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "price");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "rx");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "patient");
        access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "plntrak");

        // Run the saved import
        access1.DoCmd.RunSavedImportExport("SalisburyODBC");

        // Close the database
        access1.CloseCurrentDatabase();

        // Quit MS Access
        access1.Quit(Access.AcQuitOption.acQuitSaveAll);

       Response.Write("successful");

    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:13:42+00:00Added an answer on May 23, 2026 at 5:13 pm

    I suspect the issue is you dont close the connection if an exception is raised in the main block. Try putting the access1.CloseCurrentDatabase(); in a finally block.

    EDIT If you really want to kill the process then you can use Process.Kill. I would recomend against it though as you could cause your users to lose data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Access 2003 database that connects to a SQL Server 2008 box
I have an Access 2003 project in which all data is stored in SQL
I have an ASP application trying to access a database in SQL Server 2008.
I'm trying to access list data using SSRS 2008. I have created an XML
I have an access database with 3 tables. People Gifts PeopleGifts Using VS 2008,
I have been tasked with writing an ADP application using Access. The back-end data
I have a MS Access 2003 mdb acting as a front end for a
Switching aged 2003 SRV to 2008 caused my Asp.net 2 application fail: The application
I am upscaling an access 2003 database to SQL Server Express 2008. The tables
I'm using Access (2003 format) as a front-end with a SQL Server 2008 backend.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.