[dba-VB] ASP.NET Excel file locked after reading

Doug Murphy dw-murphy at cox.net
Tue Jun 15 10:08:05 CDT 2010


Maybe I am doing this wrong, but the first time I read the file I grab the
column headers and a few rows and then show post the page to the user so
they can correctly match which column goes into which field. After the user
selects the columns the re-submit the page and the connection to the file is
opened again and the contents read into the appropriate database table. I
dont' like to leave connections open as the user may not complete the
process. Bottom line is that there are a couple of steps to the process with
web pages going back and forth.


-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Monday, June 14, 2010 10:36 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] ASP.NET Excel file locked after reading

Hi Doug

Stupid question perhaps, but why do you need to open it more than once? Or
to be more precise: Can't you reuse the connection from the view for the
import?

/gustav


>>> dw-murphy at cox.net 15-06-2010 00:41 >>>
Folks,

I have an application on a web site that allows users to upload excel files
and then import the data into their records. After the file is uploaded
there is a routine that reads the header row and then reads the first ten
records and then presents a page where the user selects which excel columns
go into which field in the table we import into. All that works fine. The
problem is that intermittently the excel file is locked, by an open
connection I assume, and I can't get access to read in the data for the
final import, I just get a error that the file is in use. All connections
are closed after use so I can't figure out where the lock is coming from.
Some similar postings I have read on the web indicate that forced garbage
collection is required for this problem.

Any one have similar experience or suggestions to get rid of the locking?

Thanks in advance.

Doug



_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list