index > .NET Framework Data Access and Storage > Read data from an Opened excel file with attribute= archive using...

Read data from an Opened excel file with attribute= archive using...

My asp.net application reads data from excel sheet and displays data on the grid.My application and excel sheet are on the same server.If the excel sheet is opened , for example , if excel is opened manually by any users, and if the application trys to read data , the application will show an error message. The error message is as follows,

"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."

If i set the prorperty of the excel file readonly and even if it is opened by some other users , my application works fine . If i reset the property of excel file then my application will show the error again.

Connection string i am using is ,

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\\wwwroot\EBPWebAppn\EBPReport\\girish\x1_web_output.xls;Extended Properties="Excel 8.0;HDR=Yes;ReadOnly= true "

Lisha Jose

This is because file is opened by Jet in writable mode that locks the file to prevent corruption during modification by multiple users. I cannot find properties for Jet, but I believe you could specify read-only or some sort of shared property in a connection string.




Val Mazur (MVP) http://xport.mvps.org
VMazur

Try changing the share mode setting of the Workbook in Excel (Tools...Share Workbook...Allow changes by more than one user at a time).


Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV

Hi Paul

U r reply was really helpful........Now its working....

Thanks

Rose

Rose Mary
reply 4

You can use google to search for other answers

 

More Articles

• catcha sqlexception and column
• How to Read Uncommitted Data Created in Same Process?
• Data Insertion Updation Deletion in Multiple DBs
• Error in UPDATE statement Syntax with VB.NET and MS ACCESS
• how to show rows in dataset when filling it? as wizzard do.
• boolean to bit when adding a column to a DataTable
• Walkthrough: Creating a Master-Detail Windows Form
• Pragmatics of using IDbComand for direct manipulation of sql stat...
• how to get a javascript value in c#
• An error has occurred while establishing a connection to the serv...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• SQLExpress and VS 2005 - Internal .Net F
• OleDbCommand.Update method bug - paramet
• Issue in reading data from an Excel file
• remote SQL server settings
• Missing Schema Information of Base Table
• DataSet Vs DataReader????
• Informix Problem
• wwhich version of ADO.NET for DB Mirrori
• Datasets and SQL Server
• Accessing deleted row information
• Interesting behavior causing: "Ther
• Confused on the setup of VS with SQL Ser
• Problem Enumerating Sql Server Using Sys
• How to Pass in a SQL Decimal with Precis
• Master Detail Records

Hot Articles

• Typed DataSet Class not exposing its mem
• Version problem
• SQL server 2005 data base with visual st
• Requesting a list of datasources in vs 2
• got a form, got a database, the two don'
• is it possible to interrupt fill method
• DateTime Conversions
• how to retrieve image from database?
• how to open excel file (on server), writ
• mapping issue with sql executenonquery m
• Error when saving a "Computed"
• How do I grab the return value from my s
• Problem | Oracle 9i Release + With Vb.Ne
• OledbConnection and DSN
• Searching Database for results

Recommend Articles

• Excel Query: Can You Query Which Columns
• how to modify and upadate the data in da
• Client-side redirect problem
• How does .NET Data Provider for SQL Serv
• Automatic Designer Replacement of 'local
• Tableadapter Update
• How to Connect Microsoft Access database
• How do I change the location of "|D
• suggestion for data manipulation code op
• Single DateSource - Multiple Databases
• Access Excel File On Different Server **
• A problem when trying to create a SQL da
• Lightweight Transaction Manager SQL Serv
• What is the List<OdbcParameter>.En
• Problem with SQL Server 2005 and IIS 6.0