Click here to Skip to main content
14,430,298 members
Rate this:
Please Sign up or sign in to vote.
Hi.. i am using VB.net code and access DB. In my application i am doing some major table structure level changes through vb.net code. while doing this i am getting error
File sharing lock count exceeded. Increase MaxLocksPerFile registry entry

Access DB file version is 2000.
using vb.net(desktop application), vs10, access

What I have tried:

I have gone through this[^]
but i cannot do this activity at all end user's PC. So please help me to solve this at code level.

sample code
sSql = "ALTER TABLE tblTimeRegister ALTER COLUMN STATUS longtext"
            If Common.con1.State <> ConnectionState.Open Then
                Common.con1.Open()
            End If
            Dim cmd As OleDbCommand
            cmd = New OleDbCommand(sSql, Common.con1)            
            cmd.ExecuteNonQuery()

            If Common.con1.State <> ConnectionState.Closed Then
                Common.con1.Close()
            End If

note: this is just a one part of code... there are so many ADD COLUMN and ALTER COLUMN
Posted
Updated 19-Jul-19 21:01pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

At a guess - and that's all it can be, we don't have access to your full code, or to your DB - you've opened so many Commands and so forth that you have exceeded the systems lock count, possibly combined with accessing the same Access file from too many users simultaneously.

To fix the former, use Using blocks around your Command constructors to automatically Close and Dispose them when you are finished.
To fix the latter, don't use Access as a multi-user database, it always gives problems which are a PITA to fix.
   
Comments
Nitin Surya 20-Jul-19 2:37am
   
which resourceType will work for this?
OriginalGriff 20-Jul-19 3:13am
   
None. Why?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100