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

  • SEARCH
  • Home
  • 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 227301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:35:13+00:00 2026-05-11T19:35:13+00:00

Disclaimer: I know this is a bad way to do things. It is the

  • 0

Disclaimer: I know this is a bad way to do things. It is the only option we have with our client.

Problem:

We need to read data from an Excel file every x amount of time. The data is constantly changing via a 3rd party Excel plug in. The environment for the application is Windows XP, SP1 and .Net 2.0. No upgrading the OS to SP2/3 or upgrading the .Net Framework. Again, this is all per customer parameters.

Here is current code we have:

String sConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Settings.ReutersFilePath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\"";
using (OleDbConnection objConn = new OleDbConnection(sConnectionString))
{
    try
    {
        objConn.Open();
        _dataSet = new DataSet();
        OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [" + ConfigurationManager.AppSettings["Excel.WorksheetName"] + "$]", objConn);
        OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
        objAdapter1.SelectCommand = objCmdSelect;
        objAdapter1.Fill(_dataSet);
        _dataTable = _dataSet.Tables[0];
        objConn.Close();

        // Persists new data to a database.
        UpdateSQL();
    }
    catch (Exception ex) { }
    finally
    {
        _isCurrentlyProcessing = false;
        if (objConn != null && (objConn.State != ConnectionState.Broken || objConn.State != ConnectionState.Closed))
        {
            objConn.Close();
        }
    }
}

This code works when running from console or a Windows form, but when we run it from a Windows service, it cannot access the Excel file. Is there a limitation in XP w/SP1 that doesn’t allow interaction with desktop applications like there is in Vista? Can this be done from a service? The reliability of running this from a service is much needed from the client.

Edit:

The service is running as LocalSystem.

Edit #2:

The error I get when running from a service is: The Microsoft Jet database engine cannot open the file ”. It is already opened exclusively by another user, or you need permission to view its data.

The Excel file IS open on the desktop, but it has to be open for it to get updates from the 3rd party application.

  • 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-11T19:35:13+00:00Added an answer on May 11, 2026 at 7:35 pm

    In addition to @sontek’s answer.

    [only applicable If you are the owners/developers of the Spreadsheet in question…]

    You may find it easier to work with a “data push” model rather than a “data pull” model. It’s usually an easier programming model to push the data via an excel macro directly into your data store, based upon some event from your plug-in. this is often a much better scenario than a service polling on a timer.

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

Sidebar

Related Questions

The Disclaimer First of all, I know this question (or close variations) have been
DISCLAIMER: I know there is debate between DI and service locator patterns. I have
Disclaimer: this question is driven by my personal curiosity more than an actual need
Disclaimer: this question is purely informational and does not represent an actual problem I'm
[EDIT - Disclaimer: This is a really bad idea, see the accepted answer for
Disclaimer: I know there are quite a few questions out there with this topic
I will preface this question with the disclaimer that I know there are many
(Disclaimer) MY php experience is approx 2 hours old and I have know idea
Disclaimer: I have read the ASP.net page life cycle , and I've also read
Disclaimer: I have looked through this question and this question but they both got

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.