944,100 Members | Top Members by Rank

Ad:
Oct 18th, 2007
0

Getting path of host machine in VB when a client accesses the exe over the network

Expand Post »
Hi,
I am creating a small application which connects to an MS access database.
I am using app to get the path of the mdb. This works fine when I am accessing the exe from my own machine.
When I share the folder containing the exe and access it over the LAN, app looks for the mdb in the client machine. How do I reference the mdb on server?

Following is the code for db connection:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 'Module to connect to the database.
  2. Sub db_connect()
  3. Dim AccessConnect As String
  4. Dim sPath As String
  5.  
  6. sPath = App.Path & "/../MasterDB"
  7.  
  8. AccessConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
  9. "Dbq=My_Master.mdb;" & _
  10. "DefaultDir=" & sPath & ";" & _
  11. "Uid=;Pwd=test123;"
  12.  
  13. con.ConnectionString = AccessConnect
  14. con.Open
  15. End Sub

Can anyone please guide me ahead?
Regards,
ss
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
snehas is offline Offline
2 posts
since Oct 2007
Oct 19th, 2007
0

Re: Getting path of host machine in VB when a client accesses the exe over the network

instead of sPath = App.Path & "/../MasterDB"
use sPath = "\\SERVER\...\MasterDB.MDB"
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dilip_singh3 is offline Offline
24 posts
since Oct 2007
Oct 19th, 2007
0

Re: Getting path of host machine in VB when a client accesses the exe over the network

Thanks Dilip. I tried this. Didn't seem to work.
I am thinking of using a config file to get the path. Couldn't find any other way.
Regards,
ss
Reputation Points: 10
Solved Threads: 0
Newbie Poster
snehas is offline Offline
2 posts
since Oct 2007
Nov 2nd, 2007
0

Re: Getting path of host machine in VB when a client accesses the exe over the network

config file is the best way to get the path. You can read file easily
Reputation Points: 10
Solved Threads: 1
Newbie Poster
vijay.wadikar is offline Offline
4 posts
since Oct 2007
Nov 5th, 2007
0

Re: Getting path of host machine in VB when a client accesses the exe over the network

Have you ever tried the WINSOCK component?
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Oracle to visual basic
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Displaying data in a form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC