Professional Web Applications Themes

File in use error - ASP.NET Data Grid Control

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

  1. #1

    Default File in use error

    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
    [email]njsokalskihotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. #2

    Default Re: File in use error

    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]
    [email]mitchell4GuysFromRolla.com[/email]
    [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    Scott Mitchell [MVP] Guest

  3. #3

    Default Re: File in use error

    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
    [email]njsokalskihotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Scott Mitchell [MVP]" <mitchell4guysfromrolla.com> wrote in message
    news:UNmXe.92$9E2.31newssvr11.news.prodigy.com...
    > 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]
    > [email]mitchell4GuysFromRolla.com[/email]
    > [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]

    Nathan Sokalski Guest

  4. #4

    Default Re: File in use error

    If you right click on the access DB and choose for properties is the
    checkbox 'read-only' checked?
    If so uncheck it.


    "Nathan Sokalski" <njsokalskihotmail.com> wrote in message
    news:Oo6v46KvFHA.2948TK2MSFTNGP15.phx.gbl...
    > 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
    > [email]njsokalskihotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >
    > "Scott Mitchell [MVP]" <mitchell4guysfromrolla.com> wrote in message
    > news:UNmXe.92$9E2.31newssvr11.news.prodigy.com...
    > > 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]
    > > [email]mitchell4GuysFromRolla.com[/email]
    > > [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    >
    >

    Pipo Guest

  5. #5

    Default Re: File in use error

    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


    Bob Guest

  6. #6

    Default Re: File in use error

    ReadOnly was not checked.
    --
    Nathan Sokalski
    [email]njsokalskihotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Pipo" <NoSpamme.com> wrote in message
    news:OSRh%23$OvFHA.3792TK2MSFTNGP10.phx.gbl...
    > If you right click on the access DB and choose for properties is the
    > checkbox 'read-only' checked?
    > If so uncheck it.
    >
    >
    > "Nathan Sokalski" <njsokalskihotmail.com> wrote in message
    > news:Oo6v46KvFHA.2948TK2MSFTNGP15.phx.gbl...
    >> 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
    >> [email]njsokalskihotmail.com[/email]
    >> [url]http://www.nathansokalski.com/[/url]
    >>
    >> "Scott Mitchell [MVP]" <mitchell4guysfromrolla.com> wrote in message
    >> news:UNmXe.92$9E2.31newssvr11.news.prodigy.com...
    >> > 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]
    >> > [email]mitchell4GuysFromRolla.com[/email]
    >> > [url]http://www.4GuysFromRolla.com/ScottMitchell[/url]
    >>
    >>
    >
    >

    Nathan Sokalski Guest

Similar Threads

  1. File not found Error - even though file is there
    By science_of_information in forum Coldfusion Server Administration
    Replies: 1
    Last Post: September 16th, 03:55 PM
  2. Replies: 1
    Last Post: September 19th, 12:47 PM
  3. Replies: 0
    Last Post: July 23rd, 09:49 PM
  4. File Access error - writing to .txt file
    By Steve C. Orr, MCSD in forum ASP.NET General
    Replies: 1
    Last Post: July 18th, 10:35 PM
  5. Delete File Asp.NET Error: File is used by another process
    By Valeria in forum ASP.NET Security
    Replies: 1
    Last Post: July 17th, 03:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139