Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This string I am using in text file to access my database in local computer. So how will modify it to use it from LAN Networked Computer.

C:\ProgramFiles\Data\avs.mdb


This Is my Connection code...

Dim CPath As String = Application.StartupPath & "\connector.txt"
Dim SR As StreamReader
Dim DataPath As String
Dim ConnStr As String

SR = File.OpenText(CPath)
DataPath = SR.ReadLine
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & DataPath & ";Jet OLEDB:Database Password=samparksimsjbps"

conn = New OleDbConnection(ConnStr)

If conn.State <> ConnectionState.Open Then
Try
conn.Open()
Catch ex As Exception
End Try
End If
Return conn
Posted

To be perfectly honest with you, I wouldn't do it.
Directly accessing a MDB file over a network is possible - it's not even difficult, just put the file in an accessible folder and path directly to it - but it's generally a very poor idea.

Access is not good at multi user access, and the only real reason for making a DB available on a network is to have several users accessing it at the same time. Every single time I've seen this done, it gives intermittent problems which (while fixable) take a lot of time and effort to work round.

Instead, consider installing SQL Server on one PC, and accessing the database via that. It's designed for multi user and will save you a huge amount of effort.
 
Share this answer
 
Whilst I agree entirely with OriginalGriff here is what you are looking for.

The Datapath variable you use should contain the full path to the file, which if you are on a Windows network will be

\\put the machine name here\put the share name here\avs.mdb

So if the PC the file resides on has the name MyPC and you have shared the directory as DB then it will be:

\\MyPC\DB\avs.mdb

Hope it helps.
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900