HELP...C# reading from Excel in a web-from prob...

  • Thread starter Thread starter Rashrashetta
  • Start date Start date
R

Rashrashetta

Hai all,

I am trying to read and write to an excel sheet using C# in a
webform...
I'v read alot of tutorials and used it...it works BUT ONLY
ONCE...Especially when writing to the sheet...
I mean when I want to read its fine....
But when I write to the sheet...first time it does...but after I open
it ( to see the result manually )...close it...and try to write again,
it gives me an error ( configuration error ) and says "Access
denied"....
Whats the problem ?? please tell me....

I am saving the excel sheet in the (wwwroot)folder...is this a
reason??

By the way I am using the regular way to read and write ..I mean by
defining an excel application and then go to a specified range ( not
via oledb object )....

I have another question: If I desire to go to the last row in the
sheet...How can I do so???

Thanx alot,
Rashrashetta
 
don't try to open it manually after the first time you write to it. See if
it will write to it the second time. Do you have the excel sheet open while
you are trying to write to it? If I am not wrong, all office products apply
file locking when you open them.
 
in addition, you can make use of the filemon tool from sysinternals.com to
find out which process has the lock on the excel file.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
 
Back
Top