S
Sarah
I need to access some data on a server. I can access it directly using UNC
(i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network
drive resource (S:\Path\FileName).
Here is my problem: my vb.net program has problems with UNC. If the UNC
server is restarted or goes off-line, my VB.net program crashes. The code
for UNC access to the file is included below and is put in the tick event of
a form timer control running every 10 seconds. The program does not crash
when the network server goes down using the same code below except that the
network resource is referenced using a mapped drive (i.e. S:\).
=======
Try
If File.Exists("\\Server1\Files\Data1.dbf") Then
Try
File.Copy(("\\Server1\Files\Data1.dbf",
"C:\Data\tblData.dbf", True)
Catch
'Do Nothing
End Try
End If
Catch
'msgbox error
End Try
=======
The reason I would prefer to use UNC is so that the drive does not have to
be mapped on the clients computer - and the client cannot goof around with
the server files that easily (I do not have the ability to modify
permissions in this situation at all).
Note: the program only crashes after the program has been running for a
while (i.e. after multiple ticks). So, I'm guessing that if it is in the
middle of a check and the server goes down, then it crashes. Because, if you
put an invalid UNC path and start up the program, it handles that without a
problem ( i.e. no crashes, just runs every 10 seconds).
(i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network
drive resource (S:\Path\FileName).
Here is my problem: my vb.net program has problems with UNC. If the UNC
server is restarted or goes off-line, my VB.net program crashes. The code
for UNC access to the file is included below and is put in the tick event of
a form timer control running every 10 seconds. The program does not crash
when the network server goes down using the same code below except that the
network resource is referenced using a mapped drive (i.e. S:\).
=======
Try
If File.Exists("\\Server1\Files\Data1.dbf") Then
Try
File.Copy(("\\Server1\Files\Data1.dbf",
"C:\Data\tblData.dbf", True)
Catch
'Do Nothing
End Try
End If
Catch
'msgbox error
End Try
=======
The reason I would prefer to use UNC is so that the drive does not have to
be mapped on the clients computer - and the client cannot goof around with
the server files that easily (I do not have the ability to modify
permissions in this situation at all).
Note: the program only crashes after the program has been running for a
while (i.e. after multiple ticks). So, I'm guessing that if it is in the
middle of a check and the server goes down, then it crashes. Because, if you
put an invalid UNC path and start up the program, it handles that without a
problem ( i.e. no crashes, just runs every 10 seconds).