can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file
can't move file because of .ldb file can't move file because of .ldb file
can't move file because of .ldb file
Go Back  Xtreme Visual Basic Talk > > > can't move file because of .ldb file


Reply
 
Thread Tools Display Modes
  #1  
Old 09-18-2006, 03:01 PM
Donjt81 Donjt81 is offline
Freshman
 
Join Date: Jun 2005
Posts: 27
Default can't move file because of .ldb file


Hi,

I have a vb.net application that is opening an access db located on a server.
I open the db do some manipulations on it and then move the db to a different folder in the same db.

so first i open a connection like this:
Code:
   Public Sub OpenServerConnexion2(ByRef connServer As OleDb.OleDbConnection)
        Dim tConnString As String
        Dim tDBPath As String = "\\someserver\somepath\someDB.mdb"

        Dim dbcomm As OleDb.OleDbCommand
        Dim objfile As File

        'initialize the connection string 
        tConnString = "Provider=Microsoft.Jet.OLEDB.4.0..."

        'setup a new connection 
        connServer = New OleDb.OleDbConnection

        'set the connection string 
        connServer.ConnectionString = tConnString

        'attempt to open the database connection based on the connection string 
        connServer.Open()
    End Sub
and then i add/delete records in a table within this DB

and then i close the connection like this:

Code:
Public Sub CloseServerConnexion2(ByRef connServer As OleDb.OleDbConnection)
        Dim tConnString As String
        Dim tDBPath As String = "\\someserver\somepath\someDB.mdb"
        Dim dbcomm As OleDb.OleDbCommand
        Dim objfile As File

        'initialize the connection string 
        tConnString = "Provider=Microsoft.Jet.OLEDB.4.0..."

        'setup a new connection 
        connServer = New OleDb.OleDbConnection

        'set the connection string 
        connServer.ConnectionString = tConnString

        'attempt to close the database connection based on the connection string 
        connServer.Close()

    End Sub
and at the end of all this, the locking file (.ldb) is still open I would think the .ldb file will not be there anymore. Since the .ldb file is still there it wont let me move the DB to any other folder.

Now if i physically go to the server and open the DB and then close it, the .ldb file goes away.

so i dont know what is going on. please help
Reply With Quote
  #2  
Old 09-18-2006, 08:48 PM
krixna krixna is offline
Newcomer
 
Join Date: May 2005
Posts: 9
Default

Try to add Mode argument in your connection string with the folowing:

Mode=Share Deny Write
Reply With Quote
  #3  
Old 09-18-2006, 10:08 PM
wayneph's Avatar
waynephcan't move file because of .ldb file wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Also, if this is the "Close Connection" method, why are you creating a new instance of your connection in it. You shouldn't have to do any of that.

The connection already knows the connection string, and it's already an object. Your entire function can be reduced down to connServer.Close().
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file can't move file because of .ldb file
can't move file because of .ldb file
can't move file because of .ldb file
 
can't move file because of .ldb file
can't move file because of .ldb file
 
-->