Solved

Could not use ''; file already in use

Posted on 2009-05-07
5
215 Views
Last Modified: 2012-05-06
Hi Guys! Am not sure if this is a comman problem using access. I want your opinion as to why this happens. And also could you Please check to see if i have used the right code for trapping the error. Thanks in advance.
Dim con As New System.Data.OleDb.OleDbConnection
        Dim myCommand As New System.Data.OleDb.OleDbCommand
        Dim myPath As String
        Dim MaxId As Integer
 
        myPath = Server.MapPath("hayat.mdb")
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=" & myPath & ";"
        myCommand.CommandText = "select MAX(empid) from empdetails"
        myCommand.Connection = con
        Try
            con.Open()
            MaxId = myCommand.ExecuteScalar()
            lbllastid.Text = "The last Emp. ID stored is : " & MaxId.ToString
        Catch err As Exception
            lblmsg.Text = err.Message
        Finally
            con.Close()
        End Try

Open in new window

0
Comment
Question by:preethamonline
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 24323458
Hi preethamonline,
I didn't see any error here. The only things is you open access file during the application accessing the db.
You can't open it at the same time your application is connecting to this database.

0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 24323493
Hi preethamonline,
Lastly, make sure you've granted enough permission for your application to access this database if the proposed not working.
Add IUSR_<COMPUTER_NAME> to the folder that the database resides.
0
 

Author Comment

by:preethamonline
ID: 24324418
Thanks X com. I have added the IUSR_ account. Any otther ways to prevent this from occuring
0
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 24332695
Hi preethamonline,
Does the problem resolved? If the proposed not solve the problem, that could be another possibilities for this causes.
Please provide more details for your current working environment setting for further inspection if need any further assistance.
0
 

Author Comment

by:preethamonline
ID: 24342899
Hey Xcom. I'm no more getting the error. Sorry for the delay in posting. I was'nt feeling well for the past few days. Thanks a lot.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question