?
Solved

Could not use ''; file already in use

Posted on 2009-05-07
5
Medium Priority
?
222 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

764 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