Discussion:
Finding File on Network
(too old to reply)
Jim D.
2008-10-31 14:53:34 UTC
Permalink
I have written a program that resides on a PC but opens a table residing on a server. The program works fine on my own computer, but when I install it on another one, it cannot find the table. The error message indicates it is looking for the file on the C: drive rather than on the network. The reference in the program is in the form \\server name\folder\xxx.dbf. How do I force the program to look to the network?

Thanks for any help.
Geoff Wass [dBVIPS]
2008-11-01 06:06:36 UTC
Permalink
Post by Jim D.
I have written a program that resides on a PC but opens a table residing on a server. The program works fine on my own computer, but when I install it on another one, it cannot find the table. The error message indicates it is
looking for the file on the C: drive rather than on the network. The reference in the program is in the form \\server name\folder\xxx.dbf. How do I force the program to look to the network?
Post by Jim D.
Thanks for any help.
Jim,

Your program may be using c: path and not the \\server path like you
think. Check your code.

Which version of dBASE are you using and what command(s) are using to
open the table? Are you using a BDE alias?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Jim D.
2008-11-02 03:33:35 UTC
Permalink
I am using dbPlus version 2.6.1.5. In trying to find out the issue, I hard-coded the sql statement in creating the query. When I do this at the command window, it works fine (on my computer, which has the full dBASE installed). Yes, I am using the BDE. I am using Inno to create the install program. The server directory contains spaces in several subfolders, so I used quotation marks around the full address; that creates an error in the Inno compile. I think the issue may be with the BDE alias, but I'm not sure what I am doing wrong.

Jim
==================
Post by Jim D.
Post by Jim D.
I have written a program that resides on a PC but opens a table residing on a server. The program works fine on my own computer, but when I install it on another one, it cannot find the table. The error message indicates it is
looking for the file on the C: drive rather than on the network. The reference in the program is in the form \\server name\folder\xxx.dbf. How do I force the program to look to the network?
Post by Jim D.
Thanks for any help.
Jim,
Your program may be using c: path and not the \\server path like you
think. Check your code.
Which version of dBASE are you using and what command(s) are using to
open the table? Are you using a BDE alias?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Geoff Wass [dBVIPS]
2008-11-02 05:49:24 UTC
Permalink
Post by Jim D.
I am using dbPlus version 2.6.1.5. In trying to find out the issue, I hard-coded the sql statement in creating the query. When I do this at the command window, it works fine (on my computer, which has the full dBASE installed).
Yes, I am using the BDE. I am using Inno to create the install program. The server directory contains spaces in several subfolders, so I used quotation marks around the full address; that creates an error in the Inno compile. I
think the issue may be with the BDE alias, but I'm not sure what I am doing wrong.
Post by Jim D.
Jim
Jim,

Show us bit more of what you are doing if you can. Show us the section
of your proram code where the error occurs, the line on which it occurs
and the exact message you get.

The Inno Setup problem is a separate issue. You can start a new thread
in the dbase.install news group. Show us the line you have and the error
message you get. I know there are places where you have to provided
double the quotes you think you need ""c:\path"" which has tripped me up
more than once.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Larry Kinder
2008-11-03 04:19:38 UTC
Permalink
check the ini file that is created the first time the program runs. look for
something pointing to c
[Directories]
0=C:\Documents and Settings

Larry Kinder
Post by Jim D.
Post by Jim D.
I am using dbPlus version 2.6.1.5. In trying to find out the issue, I
hard-coded the sql statement in creating the query. When I do this at
the command window, it works fine (on my computer, which has the full
dBASE installed).
Yes, I am using the BDE. I am using Inno to create the install program.
The server directory contains spaces in several subfolders, so I used
quotation marks around the full address; that creates an error in the Inno
compile. I
think the issue may be with the BDE alias, but I'm not sure what I am doing wrong.
Post by Jim D.
Jim
Jim,
Show us bit more of what you are doing if you can. Show us the section
of your proram code where the error occurs, the line on which it occurs
and the exact message you get.
The Inno Setup problem is a separate issue. You can start a new thread
in the dbase.install news group. Show us the line you have and the error
message you get. I know there are places where you have to provided
double the quotes you think you need ""c:\path"" which has tripped me up
more than once.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Jim D.
2008-11-03 17:32:11 UTC
Permalink
In the setup of the query, for the sql statement, I am using (I will use the actual data from my program):

form.query1.sql=' select * from "\\casfs1\history\departmental workgroups\public\grad applications\appgsc.dbf " '

I use double quotes around the path name because of the spaces in it. On the computer where I am trying to set this up (which does not have dBASE installed, just the runtime), this produces an error of file not found (I think the text is "internal system error"). In spite of my quotation marks, dBASE parses the path up to the space after "departmental," so it is seeing an error there.

I have tried omitting the path and instead using "set directory to" and "set path to", but these don't work either.

Similarly, I have a line "restore from \\server name\path\......\gsc.mem" and dBASE also cannot find that memory file.

I realize the error is in the network path, but I can't figure out what it is. I think it may be related to the BDE settings, but in the BDE alias, I have given the correct network path.

Again, thanks for any help,
Jim

=====================
Post by Jim D.
Post by Jim D.
I am using dbPlus version 2.6.1.5. In trying to find out the issue, I hard-coded the sql statement in creating the query. When I do this at the command window, it works fine (on my computer, which has the full dBASE installed).
Yes, I am using the BDE. I am using Inno to create the install program. The server directory contains spaces in several subfolders, so I used quotation marks around the full address; that creates an error in the Inno compile. I
think the issue may be with the BDE alias, but I'm not sure what I am doing wrong.
Post by Jim D.
Jim
Jim,
Show us bit more of what you are doing if you can. Show us the section
of your proram code where the error occurs, the line on which it occurs
and the exact message you get.
The Inno Setup problem is a separate issue. You can start a new thread
in the dbase.install news group. Show us the line you have and the error
message you get. I know there are places where you have to provided
double the quotes you think you need ""c:\path"" which has tripped me up
more than once.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Geoff Wass [dBVIPS]
2008-11-04 06:21:01 UTC
Permalink
Post by Jim D.
form.query1.sql=' select * from "\\casfs1\history\departmental workgroups\public\grad applications\appgsc.dbf " '
I use double quotes around the path name because of the spaces in it. On the computer where I am trying to set this up (which does not have dBASE installed, just the runtime), this produces an error of file not found (I think
the text is "internal system error"). In spite of my quotation marks, dBASE parses the path up to the space after "departmental," so it is seeing an error there.
Post by Jim D.
I have tried omitting the path and instead using "set directory to" and "set path to", but these don't work either.
Similarly, I have a line "restore from \\server name\path\......\gsc.mem" and dBASE also cannot find that memory file.
I realize the error is in the network path, but I can't figure out what it is. I think it may be related to the BDE settings, but in the BDE alias, I have given the correct network path.
Again, thanks for any help,
Jim
Jim,

Why aren't you using a BDE alias since you say you are using the BDE?
Then all you would have to do is this:

form.db = new database( "yourBDEAliasName" )
form.query1.database := form.db
form.query1.sql := 'select * from appgsc.dbf'

There is a chance the QUERY.sql cannot handle UNC paths. I am not
certain, though. I would think that it should.

Another possibility is the typo:

Look at the end of your string: \appgsc.dbf " '

It should be: \appgsc.dbf" '

ie. Remove the space after the .dbf
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Jim D.
2008-11-04 15:06:38 UTC
Permalink
I am using the BDE; it is installed by Inno. And I checked the BDE Administrator on the computer on which I am trying to set up the program, and it has the correct path for the table (that is, the network path).

But I think I have discovered the problem. First, I should state that I am new to deploying an application over a network (or at least the table being used in the application). I made the assumption that if the user was not logged onto the network, the system would request logon information. Yes, that was not a smart assumption. Anyhow, this morning I had an idea. I logged onto my own computer without logging onto the network. When I tried to run the program, it gave me the same error messages I reported earlier. So it appears that when the user is not on the network, dBASE displays some messages that are not entirely logical. Once I logged onto the network, the program ran fine (as before).

So now the issue is: When I install the application on a notebook computer (which will have several users, all accessing the application), I need to have some way to be sure they log onto the network before launching the app. I suppose there is no way to incorporate this logon into the program. Should I just add a msgbox to the beginning of the program to remind them to get on the network before continuing? Any other ideas?

Jim Dutton
==================
Post by Jim D.
Post by Jim D.
form.query1.sql=' select * from "\\casfs1\history\departmental workgroups\public\grad applications\appgsc.dbf " '
I use double quotes around the path name because of the spaces in it. On the computer where I am trying to set this up (which does not have dBASE installed, just the runtime), this produces an error of file not found (I think
the text is "internal system error"). In spite of my quotation marks, dBASE parses the path up to the space after "departmental," so it is seeing an error there.
Post by Jim D.
I have tried omitting the path and instead using "set directory to" and "set path to", but these don't work either.
Similarly, I have a line "restore from \\server name\path\......\gsc.mem" and dBASE also cannot find that memory file.
I realize the error is in the network path, but I can't figure out what it is. I think it may be related to the BDE settings, but in the BDE alias, I have given the correct network path.
Again, thanks for any help,
Jim
Jim,
Why aren't you using a BDE alias since you say you are using the BDE?
form.db = new database( "yourBDEAliasName" )
form.query1.database := form.db
form.query1.sql := 'select * from appgsc.dbf'
There is a chance the QUERY.sql cannot handle UNC paths. I am not
certain, though. I would think that it should.
Look at the end of your string: \appgsc.dbf " '
It should be: \appgsc.dbf" '
ie. Remove the space after the .dbf
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Jim D.
2008-11-04 20:23:31 UTC
Permalink
If I want to use this simple test:

if .not. file("\\server name\folder\folder\appgsc.dbf")
msgbox("cannot operate, make sure you're connected then try again...")
endif

Where would I put the "try", "catch", and "endtry" in this example? I assume try...endtry has to be used because if the user is not connected to the network, the error message may not be all that clear.

Another small question: file() takes quotation marks around the file name. I would assume that because there are spaces in the path, single quotes and double quotes would both be required. But it doesn't work that way.

Jim
========================
Post by Jim D.
So now the issue is: When I install the application on a notebook computer (which will have several users, all accessing the application), I need to have some way to be sure they log onto the network before launching the app. I suppose there is no way to incorporate this logon into the program. Should I just add a msgbox to the beginning of the program to remind them to get on the network before continuing? Any other ideas?
What type of network are you using, what type of server
(excuse me if the question already was asked/answered; I only now jumped
at this thread...)
The best way would probably be to make sure that each user _IS_
automatically connected to the network, without having to do anything
for themselves.
If you can't do this, you'd probably want to make a quick test on
startup of your application.
This can be done by trying to find a certain file, which can only be on
the server, or even by trying to access a table which should be on the
server.
try
// here some code to find the file
catch
msgbox("cannot operate, make sure you're connected then try again...")
quit // or whatever you are using to cancel your application
endtry
*Lysander*
2008-11-04 23:10:41 UTC
Permalink
Post by Jim D.
Where would I put the "try", "catch", and "endtry" in this example? I assume try...endtry has to be used because if the user is not connected to the network, the error message may not be all that clear.
You would better use the object oriented method and use an instance of
the "file" class, like the following.

#define fHome "\\server name\folder\folder\appgsc.dbf"

f = new File()
try
f.open( fHome, "A" )
f.close()
catch
msgbox("cannot operate, make sure you're connected then try again...")
quit // or whatever you do to shutdown your application
endtry
Lysander
2008-11-04 16:47:07 UTC
Permalink
Post by Jim D.
So now the issue is: When I install the application on a notebook computer (which will have several users, all accessing the application), I need to have some way to be sure they log onto the network before launching the app. I suppose there is no way to incorporate this logon into the program. Should I just add a msgbox to the beginning of the program to remind them to get on the network before continuing? Any other ideas?
What type of network are you using, what type of server
(excuse me if the question already was asked/answered; I only now jumped
at this thread...)

The best way would probably be to make sure that each user _IS_
automatically connected to the network, without having to do anything
for themselves.


If you can't do this, you'd probably want to make a quick test on
startup of your application.

This can be done by trying to find a certain file, which can only be on
the server, or even by trying to access a table which should be on the
server.

try
// here some code to find the file
catch
msgbox("cannot operate, make sure you're connected then try again...")
quit // or whatever you are using to cancel your application
endtry
Jim D.
2008-11-04 19:22:09 UTC
Permalink
I don't know a lot about the server; I am fairly certain it is running Windows.

The trouble with trying to test for the existence of a file on the server is that if the user is not connected, an odd error message will appear (something like "an internal error has occurred"). Will the "try...catch" you suggested eliminate that error message?

I cannot make sure the users are connected automatically to the network. Some will be using their own computers, and I can have the network people set them up on Active Directory with a required logon when they start the machine. But other users (either because they are accessing the application from elsewhere or because they have Macintosh computers and so cannot use dBASE) will be using a laptop, so I cannot make logging onto the network standard.

Thanks for your help,
Jim
================
Post by Jim D.
So now the issue is: When I install the application on a notebook computer (which will have several users, all accessing the application), I need to have some way to be sure they log onto the network before launching the app. I suppose there is no way to incorporate this logon into the program. Should I just add a msgbox to the beginning of the program to remind them to get on the network before continuing? Any other ideas?
What type of network are you using, what type of server
(excuse me if the question already was asked/answered; I only now jumped
at this thread...)
The best way would probably be to make sure that each user _IS_
automatically connected to the network, without having to do anything
for themselves.
If you can't do this, you'd probably want to make a quick test on
startup of your application.
This can be done by trying to find a certain file, which can only be on
the server, or even by trying to access a table which should be on the
server.
try
// here some code to find the file
catch
msgbox("cannot operate, make sure you're connected then try again...")
quit // or whatever you are using to cancel your application
endtry
Geoff Wass [dBVIPS]
2008-11-05 05:18:08 UTC
Permalink
Post by Jim D.
I am using the BDE; it is installed by Inno. And I checked the BDE Administrator on the computer on which I am trying to set up the program, and it has the correct path for the table (that is, the network path).
But I think I have discovered the problem. First, I should state that I am new to deploying an application over a network (or at least the table being used in the application). I made the assumption that if the user was not
logged onto the network, the system would request logon information. Yes, that was not a smart assumption. Anyhow, this morning I had an idea. I logged onto my own computer without logging onto the network. When I tried to run
the program, it gave me the same error messages I reported earlier. So it appears that when the user is not on the network, dBASE displays some messages that are not entirely logical. Once I logged onto the network, the program
ran fine (as before).
Post by Jim D.
So now the issue is: When I install the application on a notebook computer (which will have several users, all accessing the application), I need to have some way to be sure they log onto the network before launching the app. I
suppose there is no way to incorporate this logon into the program. Should I just add a msgbox to the beginning of the program to remind them to get on the network before continuing? Any other ideas?
Post by Jim D.
Jim Dutton
Jim,

You could use MiscWSH.prg in the dUFLP. It has functions like
GetAllDrivesType(), GetNetAbsolutePath() and ListNetworkProperties()
that could potentially be used to test for the existance of the network.
For instance, if I recall correctly, network drives will be "REMOTE" so
if GetAllDrivesType() has no such drives you know you have no network.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Loading...