tags:

views:

60

answers:

3

I am trying to do that by using OleDb but the file is protected by a password which i dont have. So it gives the following error when i open the connection: Cannot update. Database or object is read-only. How can i solve this? thanks

A: 

You need to specify your UserId and Password in your Connection String same as with a SQL connection. Unfortunately, this means that you'll have to get the password.

If you can't get the password, you might be able to open the spreadsheet in Read-Only mode and copy the data from it into a new spreadsheet and read that one...

Logan Young
In case i cant get the password, this is the only way? Because it seems rather long.
medusa
The thing about the file being password protected is that if you don't have the password, then you shouldn't be manipulating the data in the spreadsheet.Here is where I'd prefer to get info on what exactly is the purpose of your application as we're now entering into security concerns and I'd like to be sure I'm not helping someone do something illegal or immoral...But yes, if you don't have the password, but need to modify the data, creating a new spreadsheet is the only solution I can see...
Logan Young
the idea is this: the file should be uploaded somewhere in the application and i need to extract some information from it. But it is readonly because people downloading it afterwards should not be able to modify its content. So i dont need to modify the file, it should remain read-only for other users of the application. But, supposing i can find a way to have that pass, for example promting for it at the moment of the uploading, can i read it then using Ado.net?
medusa
If you can arrange a way to allow the user of your app to input the password, you can do whatever you want with it.Although, if you don't need to modify it then the Read Only shouldn't be a problem for you. I've never worked with passworded spreadsheets myself, but I'll do a little fiddling on one of my spreadsheets here and let you know what I come up with
Logan Young
A: 

Assuming you're talking about an Excel file that you're allowed to view but that's locked for editing with a password. I'm fairly certain that OleDB won't support that.

You could probably open the file using Excel Automation and copy the data into your app from there however.

ho1