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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:37:15+00:00 2026-05-25T23:37:15+00:00

My connection string is: String excelConn = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + Server.MapPath(abc.xls) + ;Extended Properties=’Excel

  • 0

My connection string is:

String excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("abc.xls") + ";Extended Properties='Excel 8.0; HDR=YES;IMEX=1'";

OleDbConnection conn = new OleDbConnection(excelConn);  
Conn.Open();

It gives an error, like “Could not decrypt file.” If my Excel file (abc.xls) is close in my client PC. But it is ok when my excel file is open.

  • 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-25T23:37:16+00:00Added an answer on May 25, 2026 at 11:37 pm

    you cannot connect to a password protected excel file with OleDbConnection, it won’t work by design.

    Check here: Open a password-protected Excel workbook

    If you try to open a password-protected Excel workbook from Access,
    you get an error message “Could not decrypt file”. Adding a Password=
    value to your connection string won’t work either. You could open it
    as an Excel application, but then you’d have to learn about the Excel
    object model and all you want to do is read it row-by-row as you would
    any unprotected Excel file.

    To get around this problem, first open the Excel workbook using
    GetObject() and then open it using the connection / recordset approach
    that you want to use. The GetObject() open prompts your user for the
    password, and then you are free to open the file using your preferred
    approach.

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

Sidebar

Related Questions

a usual connection string would look like Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\file.csv;Extended Properties=text;HDR=Yes;FMT=Delimited; but i need a
Here's my connection string: sConnection = @Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\ + lstNet.SelectedItem.ToString() + \SharedDocs\Documents\Debug\App_File\ggbase.mdb;Jet OLEDB:Database Password=g3n3r4l;;
Here's what my connection string looks like.. m_conn = new OleDbConnection(String.Format(Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties= +
Every SQL Server connection string I ever see looks something like this: Data Source=MyLocalSqlServerInstance;Initial
I have the following connection string: <add name=DataContext connectionString=DATA SOURCE=Server; PASSWORD=123;USER ID=SYSTEM providerName=Oracle.DataAccess.Client/> My
Using a connection string of Provider=SQLOLEDB;Data Source=localhost;User ID=foo;password=bar;Database=CodeLists;Pooling=true;Min Pool Size=20;Max Pool Size=30; I get
Given the following connection string (for SQL Server CE 4.0) Data Source=|DataDirectory|IntegrationTests.sdf how do
I have a connection string (SQL Server): Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; My goal is
I'm using this connection string to access excel(2007,2010) files oleConnection.ConnectionString = @Provider=Microsoft.ACE.OLEDB.12.0;Data Source= +
I have following connection string: metadata=res:// /Database.csdl|res:// /Database.ssdl|res://*/Database.msl;provider=System.Data.SqlClient;provider connection string=Data Source=.\SQLEXPRESS;AttachDbFilename='Database.mdf';Integrated Security=True;User Instance=True;Connection Timeout=300;

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.