Discussion:
Weird Open Database problem
(too old to reply)
damezumari
2010-05-22 01:18:04 UTC
Permalink
I use vfp9 sp2 and win xp.

The code below works as expected compiled and not compiled:

dummy = 'C:\Data folder for J Nordgreen Report cards June
2010\reportcard.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())

dummy = 'C:\9FS\form.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())

It responds with:
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\9FS\form.dbc

However, when I run the same code as part of a bigger project only the
non-compiled version works as expected. The compiled version returns:
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\gis_programs\gis_form\data\form.dbc

The exe file sits in C:\gis_programs\gis_form\ and earlier in the
program I set C:\gis_programs\gis_form\data\ as part of the path.
However, why should the path matter when I give the entire path to the
database when I open it? And why does the first database open as
expected?

The deadline for this project is tomorrow so a solution to this
problem is very much appreciated. :)

Regards,

Jan Nordgreen
Dan Freeman
2010-05-22 03:05:37 UTC
Permalink
When you encounter differences between source code execution and
compiled EXE execution, you're usually not running the EXE that you
think you're running. Either you've got an older version, or you've
SUSPENDed from previous tests so later compiles can't create a new
version.

That said, VFP does funky things when it cannot find a file at runtime.
(It's a throwback to the interactive nature of the produt.) If it can
find the right filename in the search path, it'll use what it finds.

(Obvious solution: resolve the original problem or don't have
same-named files on the search path.)

Dan
Post by damezumari
I use vfp9 sp2 and win xp.
dummy = 'C:\Data folder for J Nordgreen Report cards June
2010\reportcard.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())
dummy = 'C:\9FS\form.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\9FS\form.dbc
However, when I run the same code as part of a bigger project only the
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\gis_programs\gis_form\data\form.dbc
The exe file sits in C:\gis_programs\gis_form\ and earlier in the
program I set C:\gis_programs\gis_form\data\ as part of the path.
However, why should the path matter when I give the entire path to the
database when I open it? And why does the first database open as
expected?
The deadline for this project is tomorrow so a solution to this
problem is very much appreciated. :)
Regards,
Jan Nordgreen
damezumari
2010-05-23 00:26:30 UTC
Permalink
Post by Dan Freeman
When you encounter differences between source code execution and
compiled EXE execution, you're usually not running the EXE that you
think you're running. Either you've got an older version, or you've
SUSPENDed from previous tests so later compiles can't create a new
version.
That said, VFP does funky things when it cannot find a file at runtime.
(It's a throwback to the interactive nature of the produt.) If it can
find the right filename in the search path, it'll use what it finds.
(Obvious solution: resolve the original problem or don't have
same-named files on the search path.)
Dan
Post by damezumari
I use vfp9 sp2 and win xp.
dummy = 'C:\Data folder for J Nordgreen Report cards June
2010\reportcard.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())
dummy = 'C:\9FS\form.dbc'
OPEN DATABASE (dummy)
MESSAGEBOX (DBC())
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\9FS\form.dbc
However, when I run the same code as part of a bigger project only the
C:\Data folder for J Nordgreen Report cards June 2010\reportcard.dbc
C:\gis_programs\gis_form\data\form.dbc
The exe file sits in C:\gis_programs\gis_form\ and earlier in the
program I set C:\gis_programs\gis_form\data\ as part of the path.
However, why should the path matter when I give the entire path to the
database when I open it? And why does the first database open as
expected?
The deadline for this project is tomorrow so a solution to this
problem is very much appreciated. :)
Regards,
Jan Nordgreen
Hi Dan,

Thank you for answering!

I did run the exe I thought I was running as I checked 'Run after
build' when I created it.

I renamed the database and that solved the problem!

What I learnt was that 'open database folder\database.dbc' will ignore
the folder part if database.dbc is in the path set with 'set path'.

Regards,

Jan

Continue reading on narkive:
Loading...