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 1048249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:25:35+00:00 2026-05-16T16:25:35+00:00

I have an ASP.NET web application that has a fileupload control to allow users

  • 0

I have an ASP.NET web application that has a fileupload control to allow users to upload an excel file for it to read.

I’m using an OleDBConnection and I feel like my connection string or querystring is wrong since the app keeps throwing OleDBExceptions at me (ouch!). What would be a good way to save or access the uploaded files?

Here’s the connection string:

olcon.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(fileupFile.FileName) + ";Extended Properties=Excel 12.0";

Query string:

OleDbCommand olcmd = new OleDbCommand("SELECT * FROM [Sheet1$]", olcon);
  • 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-16T16:25:36+00:00Added an answer on May 16, 2026 at 4:25 pm

    I suspect the issue is rooted in the call to Server.MapPath(fileupFile.FileName). The FileName property is a convenience property to indicate the original file name of the content being uploaded to the server. It doesn’t necessarily indicate the location or the name of the file when (and if) you save it on the server.

    It would seem that you still need to receive the file on the server side and save it to disk. There are several ways to do so. The SaveAs() method is perhaps the easiest, but you also have the FileBytes and FileContent properties which give you access to the uploaded file as a byte array or a stream, respectively.

    If you first save the document to your hard drive and then construct your connection string, I believe that will resolve the issue.

    Here is a simple example of saving an uploaded file. Assume that the “~/Documents” folder has granted the IIS worker process write permissions (or that you use impersonation and your authenticated user has write permissions):

    var targetfilepath = Path.Combine(Server.MapPath(~/Documents), fileupFile.FileName);
    fileupFile.SaveAs(targetfilepath);
    
    var connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + targetfilepath + ";Extended Properties=Excel 12.0";
    // ...
    

    Good luck.

    By the way, and you may already know, there is an excellent reference on Excel 2007 connection string properties at connectionstrings.com: http://connectionstrings.com/excel-2007

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

Sidebar

Related Questions

I have a code base that has been used as an ASP.Net web application.
I have a web application on ASP.NET (C#) that has some precompiled components. I've
I have an ASP.NET Web Application that has several references set. I have Copy
I have an asp.net web application that use FormsAuthentication. Now, the application has a
I currently have a ASP.Net MVC web application that needs to upload large files
I have an ASP.NET web application I'm running with VS2010 that has session timeout
In my ASP.NET web-based application, I have a normal ASP.NET button that has a
My web application allows authorised users to upload videos using the ASP.NET WebForms FileUpload
So I have an ASP.NET MVC web application that has a silverlight application embedded
I have a asp.net web application that uses C#. It logs in on a

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.