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

Reply

Join Date: Oct 2007
Posts: 2
Reputation: snehas is an unknown quantity at this point 
Solved Threads: 0
snehas snehas is offline Offline
Newbie Poster

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

 
0
  #1
Oct 18th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 24
Reputation: dilip_singh3 is an unknown quantity at this point 
Solved Threads: 0
dilip_singh3 dilip_singh3 is offline Offline
Newbie Poster

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

 
0
  #2
Oct 19th, 2007
instead of sPath = App.Path & "/../MasterDB"
use sPath = "\\SERVER\...\MasterDB.MDB"
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 2
Reputation: snehas is an unknown quantity at this point 
Solved Threads: 0
snehas snehas is offline Offline
Newbie Poster

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

 
0
  #3
Oct 19th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 4
Reputation: vijay.wadikar is an unknown quantity at this point 
Solved Threads: 1
vijay.wadikar's Avatar
vijay.wadikar vijay.wadikar is offline Offline
Newbie Poster

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

 
0
  #4
Nov 2nd, 2007
config file is the best way to get the path. You can read file easily
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 561
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

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

 
0
  #5
Nov 5th, 2007
Have you ever tried the WINSOCK component?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC