Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > File in use error

Reply
Thread Tools

File in use error

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-18-2005
I am recieving an error about not being able to use a file because it is
already in use. Based on the error, I think it is referring to my DB, but I
don't know how to avoid the error or why it is happening. Here is the error:
Server Error in '/LVBEP' Application.
--------------------------------------------------------------------------------

Could not use ''; file already in use.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Could not use ''; file
already in use.

Source Error:

Line 41: Dim memberadapter As New OleDb.OleDbDataAdapter("SELECT *
FROM members ORDER BY name", "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
& Server.MapPath("LVBEP.mdb"))
Line 42:
Line 43: memberadapter.Fill(members)
Line 44: datEditMembers.DataSource = members
Line 45: datEditMembers.DataBind()

Source File: C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb Line: 43

Stack Trace:

[OleDbException (0x80004005): Could not use ''; file already in use.]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
LVBEP.memberadmin.RefreshMembers() in
C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:43
LVBEP.memberadmin.Page_Init(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:27
System.Web.UI.Control.OnInit(EventArgs e) +67
System.Web.UI.Control.InitRecursive(Control namingContainer) +241
System.Web.UI.Page.ProcessRequestMain() +197



--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      09-18-2005
Make sure your Access database file is NOT open in Windows. I.e., make
sure you are closed out of it. I don't know if that's the cause of YOUR
error, but I do know that things can get 'funky' if you have Access
opened, inspecting/modifying your database, and you try to work with it
via an ASP.NET page...

hth



Nathan Sokalski wrote:
> I am recieving an error about not being able to use a file because it is
> already in use. Based on the error, I think it is referring to my DB, but I
> don't know how to avoid the error or why it is happening. Here is the error:
> Server Error in '/LVBEP' Application.
> --------------------------------------------------------------------------------
>
> Could not use ''; file already in use.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.Data.OleDb.OleDbException: Could not use ''; file
> already in use.
>
> Source Error:
>
> Line 41: Dim memberadapter As New OleDb.OleDbDataAdapter("SELECT *
> FROM members ORDER BY name", "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
> & Server.MapPath("LVBEP.mdb"))
> Line 42:
> Line 43: memberadapter.Fill(members)
> Line 44: datEditMembers.DataSource = members
> Line 45: datEditMembers.DataBind()
>
> Source File: C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb Line: 43
>
> Stack Trace:
>
> [OleDbException (0x80004005): Could not use ''; file already in use.]
> System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
> System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
> System.Data.OleDb.OleDbConnection.Open() +203
> System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
> ConnectionState& originalState) +44
> System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior) +304
> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
> Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> behavior) +77
> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
> LVBEP.memberadmin.RefreshMembers() in
> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:43
> LVBEP.memberadmin.Page_Init(Object sender, EventArgs e) in
> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:27
> System.Web.UI.Control.OnInit(EventArgs e) +67
> System.Web.UI.Control.InitRecursive(Control namingContainer) +241
> System.Web.UI.Page.ProcessRequestMain() +197
>
>
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
> Version:1.1.4322.2032



--

Scott Mitchell [ASP.NET MVP]
(E-Mail Removed)
http://www.4GuysFromRolla.com/ScottMitchell
 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-19-2005
I did not have Access (or any other programs that use Access or any Access
DBs) open at the time. I even tried restarting my computer to make sure
nothing was running in the background, but it did not help.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Scott Mitchell [MVP]" <(E-Mail Removed)> wrote in message
news:UNmXe.92$(E-Mail Removed)...
> Make sure your Access database file is NOT open in Windows. I.e., make
> sure you are closed out of it. I don't know if that's the cause of YOUR
> error, but I do know that things can get 'funky' if you have Access
> opened, inspecting/modifying your database, and you try to work with it
> via an ASP.NET page...
>
> hth
>
>
>
> Nathan Sokalski wrote:
>> I am recieving an error about not being able to use a file because it is
>> already in use. Based on the error, I think it is referring to my DB, but
>> I don't know how to avoid the error or why it is happening. Here is the
>> error:
>> Server Error in '/LVBEP' Application.
>> --------------------------------------------------------------------------------
>>
>> Could not use ''; file already in use.
>> Description: An unhandled exception occurred during the execution of the
>> current web request. Please review the stack trace for more information
>> about the error and where it originated in the code.
>>
>> Exception Details: System.Data.OleDb.OleDbException: Could not use '';
>> file already in use.
>>
>> Source Error:
>>
>> Line 41: Dim memberadapter As New OleDb.OleDbDataAdapter("SELECT
>> * FROM members ORDER BY name", "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
>> SOURCE=" & Server.MapPath("LVBEP.mdb"))
>> Line 42:
>> Line 43: memberadapter.Fill(members)
>> Line 44: datEditMembers.DataSource = members
>> Line 45: datEditMembers.DataBind()
>>
>> Source File: C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb Line: 43
>>
>> Stack Trace:
>>
>> [OleDbException (0x80004005): Could not use ''; file already in use.]
>> System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
>> System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
>> System.Data.OleDb.OleDbConnection.Open() +203
>> System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
>> ConnectionState& originalState) +44
>> System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
>> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
>> CommandBehavior behavior) +304
>> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
>> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
>> CommandBehavior behavior) +77
>> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
>> LVBEP.memberadmin.RefreshMembers() in
>> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:43
>> LVBEP.memberadmin.Page_Init(Object sender, EventArgs e) in
>> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:27
>> System.Web.UI.Control.OnInit(EventArgs e) +67
>> System.Web.UI.Control.InitRecursive(Control namingContainer) +241
>> System.Web.UI.Page.ProcessRequestMain() +197
>>
>>
>>
>> --------------------------------------------------------------------------------
>> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
>> ASP.NET Version:1.1.4322.2032

>
>
> --
>
> Scott Mitchell [ASP.NET MVP]
> (E-Mail Removed)
> http://www.4GuysFromRolla.com/ScottMitchell



 
Reply With Quote
 
Pipo
Guest
Posts: n/a
 
      09-19-2005
If you right click on the access DB and choose for properties is the
checkbox 'read-only' checked?
If so uncheck it.


"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I did not have Access (or any other programs that use Access or any Access
> DBs) open at the time. I even tried restarting my computer to make sure
> nothing was running in the background, but it did not help.
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "Scott Mitchell [MVP]" <(E-Mail Removed)> wrote in message
> news:UNmXe.92$(E-Mail Removed)...
> > Make sure your Access database file is NOT open in Windows. I.e., make
> > sure you are closed out of it. I don't know if that's the cause of YOUR
> > error, but I do know that things can get 'funky' if you have Access
> > opened, inspecting/modifying your database, and you try to work with it
> > via an ASP.NET page...
> >
> > hth
> >
> >
> >
> > Nathan Sokalski wrote:
> >> I am recieving an error about not being able to use a file because it

is
> >> already in use. Based on the error, I think it is referring to my DB,

but
> >> I don't know how to avoid the error or why it is happening. Here is the
> >> error:
> >> Server Error in '/LVBEP' Application.

>
>> -------------------------------------------------------------------------

-------
> >>
> >> Could not use ''; file already in use.
> >> Description: An unhandled exception occurred during the execution of

the
> >> current web request. Please review the stack trace for more information
> >> about the error and where it originated in the code.
> >>
> >> Exception Details: System.Data.OleDb.OleDbException: Could not use '';
> >> file already in use.
> >>
> >> Source Error:
> >>
> >> Line 41: Dim memberadapter As New

OleDb.OleDbDataAdapter("SELECT
> >> * FROM members ORDER BY name", "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
> >> SOURCE=" & Server.MapPath("LVBEP.mdb"))
> >> Line 42:
> >> Line 43: memberadapter.Fill(members)
> >> Line 44: datEditMembers.DataSource = members
> >> Line 45: datEditMembers.DataBind()
> >>
> >> Source File: C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb Line: 43
> >>
> >> Stack Trace:
> >>
> >> [OleDbException (0x80004005): Could not use ''; file already in use.]
> >> System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
> >> System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
> >> System.Data.OleDb.OleDbConnection.Open() +203
> >> System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection,
> >> ConnectionState& originalState) +44
> >> System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
> >> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> >> CommandBehavior behavior) +304
> >> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> >> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> >> CommandBehavior behavior) +77
> >> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
> >> LVBEP.memberadmin.RefreshMembers() in
> >> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:43
> >> LVBEP.memberadmin.Page_Init(Object sender, EventArgs e) in
> >> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:27
> >> System.Web.UI.Control.OnInit(EventArgs e) +67
> >> System.Web.UI.Control.InitRecursive(Control namingContainer) +241
> >> System.Web.UI.Page.ProcessRequestMain() +197
> >>
> >>
> >>

>
>> -------------------------------------------------------------------------

-------
> >> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
> >> ASP.NET Version:1.1.4322.2032

> >
> >
> > --
> >
> > Scott Mitchell [ASP.NET MVP]
> > (E-Mail Removed)
> > http://www.4GuysFromRolla.com/ScottMitchell

>
>



 
Reply With Quote
 
Bob
Guest
Posts: n/a
 
      09-19-2005
Nathan:

Make sure your closing your connection after you access your data in your
code.

Look for a file LVBEP..ldb on the server in the same dir as the LVBEP.mdb
file. If it it's there, delete it.

If you have access to the IIS Administrator, open the IIS Admin.

Right click the site and click properties. Click the "home Directory" tab
and click the "Unload" button then delete the LVBEP.ldb file.

Then try your connection again. As I said, make extra sure your closing the
connection in your code.

MyOLEDBConnection.Open()

Fill your dataAdapters

MyOLEDBConnection.Close()

By chance, your not developing against a DB that is also in production are
you?

Make sure your Access file is not in the root. Put it in a sub dir of the
root and don't give the "Everyone" account read permissions.

Be sure not to load data directly into a session object. Use sessions
sparingly.

HTH

Bob


 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-19-2005
ReadOnly was not checked.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Pipo" <(E-Mail Removed)> wrote in message
news:OSRh%23$(E-Mail Removed)...
> If you right click on the access DB and choose for properties is the
> checkbox 'read-only' checked?
> If so uncheck it.
>
>
> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I did not have Access (or any other programs that use Access or any
>> Access
>> DBs) open at the time. I even tried restarting my computer to make sure
>> nothing was running in the background, but it did not help.
>> --
>> Nathan Sokalski
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>
>> "Scott Mitchell [MVP]" <(E-Mail Removed)> wrote in message
>> news:UNmXe.92$(E-Mail Removed)...
>> > Make sure your Access database file is NOT open in Windows. I.e., make
>> > sure you are closed out of it. I don't know if that's the cause of
>> > YOUR
>> > error, but I do know that things can get 'funky' if you have Access
>> > opened, inspecting/modifying your database, and you try to work with it
>> > via an ASP.NET page...
>> >
>> > hth
>> >
>> >
>> >
>> > Nathan Sokalski wrote:
>> >> I am recieving an error about not being able to use a file because it

> is
>> >> already in use. Based on the error, I think it is referring to my DB,

> but
>> >> I don't know how to avoid the error or why it is happening. Here is
>> >> the
>> >> error:
>> >> Server Error in '/LVBEP' Application.

>>
>>> -------------------------------------------------------------------------

> -------
>> >>
>> >> Could not use ''; file already in use.
>> >> Description: An unhandled exception occurred during the execution of

> the
>> >> current web request. Please review the stack trace for more
>> >> information
>> >> about the error and where it originated in the code.
>> >>
>> >> Exception Details: System.Data.OleDb.OleDbException: Could not use '';
>> >> file already in use.
>> >>
>> >> Source Error:
>> >>
>> >> Line 41: Dim memberadapter As New

> OleDb.OleDbDataAdapter("SELECT
>> >> * FROM members ORDER BY name", "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
>> >> SOURCE=" & Server.MapPath("LVBEP.mdb"))
>> >> Line 42:
>> >> Line 43: memberadapter.Fill(members)
>> >> Line 44: datEditMembers.DataSource = members
>> >> Line 45: datEditMembers.DataBind()
>> >>
>> >> Source File: C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb Line: 43
>> >>
>> >> Stack Trace:
>> >>
>> >> [OleDbException (0x80004005): Could not use ''; file already in use.]
>> >> System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
>> >> System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
>> >> System.Data.OleDb.OleDbConnection.Open() +203
>> >> System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection
>> >> connection,
>> >> ConnectionState& originalState) +44
>> >> System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
>> >> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
>> >> CommandBehavior behavior) +304
>> >> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
>> >> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
>> >> CommandBehavior behavior) +77
>> >> System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
>> >> LVBEP.memberadmin.RefreshMembers() in
>> >> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:43
>> >> LVBEP.memberadmin.Page_Init(Object sender, EventArgs e) in
>> >> C:\Inetpub\wwwroot\LVBEP\memberadmin.aspx.vb:27
>> >> System.Web.UI.Control.OnInit(EventArgs e) +67
>> >> System.Web.UI.Control.InitRecursive(Control namingContainer) +241
>> >> System.Web.UI.Page.ProcessRequestMain() +197
>> >>
>> >>
>> >>

>>
>>> -------------------------------------------------------------------------

> -------
>> >> Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
>> >> ASP.NET Version:1.1.4322.2032
>> >
>> >
>> > --
>> >
>> > Scott Mitchell [ASP.NET MVP]
>> > (E-Mail Removed)
>> > http://www.4GuysFromRolla.com/ScottMitchell

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not use ''; file already in use. M K ASP .Net 11 04-09-2008 11:35 AM
Microsoft JET Database Engine error '80004005' Could not use ''; filealready in use. Mel ASP General 2 12-16-2007 04:49 PM
Error - System.Data.OleDb.OleDbException: Could not use ''; file already in use. - please help Learner ASP .Net 6 02-16-2006 09:29 AM
Compiler error occurred when try to use a flexible template expression in preprocessor definesCompiler error occurred when try to use a flexible template expression in preprocessor defines snnn C++ 6 03-14-2005 04:09 PM
Help with "Couldn't Use '(unknown)'; File Already in Use" error Ian U ASP General 4 09-23-2004 12:51 PM



Advertisments