By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,281 Members | 2,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,281 IT Pros & Developers. It's quick & easy.

Disconnected mapped network drive

P: n/a
Hello,
Im grabbing tables via VB code using visual foxpro ODBC drives.
The tables directory is in a mapped network drive. The code works fine
and does the job, however if the computer is idle for a while the
network drive apears to have a red X on the icon and the drive becomes
disconnected. this seems to effect the VB code from grabbing the
tables. I get an error saying the specific table cannot be found. If i
manually open the mapped network drive it than becomes reconnected and
the code can find the table again.
Is there anyway the mapped network drive can always stay connected even
if it is not in use. I want to prevent this error caused by the network
drive being disconnected.
Any suggestions?
Thanks,
Gil

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 10 Nov 2005 21:46:28 -0800, gi*******@gmail.com wrote:
Hello,
Im grabbing tables via VB code using visual foxpro ODBC drives.
The tables directory is in a mapped network drive. The code works fine
and does the job, however if the computer is idle for a while the
network drive apears to have a red X on the icon and the drive becomes
disconnected. this seems to effect the VB code from grabbing the
tables. I get an error saying the specific table cannot be found. If i
manually open the mapped network drive it than becomes reconnected and
the code can find the table again.
Is there anyway the mapped network drive can always stay connected even
if it is not in use. I want to prevent this error caused by the network
drive being disconnected.
Any suggestions?
Thanks,
Gil


I did battle with this a while back, and it's a hard one. What I finally
ended up doing is using dll calls to get the unc path the drive is mapped to,
then using the UNC path to access the tables.

I found that the API cannot be used to reliably determine whether the mapped
drive is actually connected or not, so don't be fooled into going down that
path. Since you can get the UNC path for the drive whether it's currently
connected or not, just do a little string parsing to substitute the UNC path
for the drive letter in the original path string, and you're good to go.

While we're on the subject, UNC paths are a support nightmare, no matter what
you do. People can leave drives mapped to a test copy of a database, or they
can map a drive on a system, assuming that means it's mapped for all users on
the system, while the drive mapping is actually only preserved for the user
who created the mapping. The only semi-reliable way of using mapped drives in
a multi-user environment is to user logon scripts.
Nov 13 '05 #2

P: n/a
I believe if you use the following on the server storing your
tables....

At a command prompt type the following:

net config server /autodisconnect:-1

The "-1" disables autodisconnect feature of the Server service.

osmethod

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.