Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Could not use ''; file already in use

Posted on 2009-05-07
5
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Independent Software Vendors: 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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

618 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