Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Mark Buckley
  
 
 
 Mark Buckley
 Tags
Subject: RE: Can't access vfp database on server
Thread ID: 203295 Message ID: 203513 # Views: 24 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Friday, November 14, 2008 6:19:56 AM         
   


> >
> > Hope I understood your problem correctly. If you are planning to run the application from different PCs on the LAN, you will be building an EXE file and deploying the same on a server or on every PCs from where it will be run. In that case you will be putting all the database and tables on a central location in server, accessible by all users. So why you have to include the same in project? I do not include the database in project but in the main program I set the path to the database and tables. Then I open the tables/database as and when needed in the program.
> > Benny
>
>
>
> I Found the answer - The database was part of the project because that is where I created it. Upon research I changed "beforeopentables" for each form to change the database location. What I did not realize was that in the project info the *.dbc was flagged as an included file. What that did was to make it impossible to change database locations. Once I removed the "include" flag from *.dbc in the project info and rebuilt the project, The "set path =" and "This.cursor.database =" included on each form worked.
>

Probably just a typo?, the syntax would be
Set Path To (expression)


as opposed to config.fpw syntax:
path = expression



> I am now able to specify a different database location. What I don't know how to do is to pick up a location from an .ini or config.fpw so that I can change database locations on site without rebuilding the project.
>

The config.fpw approach would require an excluded config.fpw file that you'd ship separately, so that you can edit it manually on each client workstation.

As opposed to the programmatic approach - its pattern would go like this:
- You'd have a function or class.method() returning the desired path.

- That function would read from a local DBF or Windows Registry, XML file, whatever.
(If you use a file, the code would look for it, and create it if not available yet. The file location would not be inside GETENV("ProgramFiles") but rather in a subfolder of GetEnv('appdata'), in order to work for WinXP Limited accouts, and Vista, too)

- if the desired path is not found in that location, say when the application runs the first time, your code would ask the user via GetDir() or similar, and then store the result for next time.
When the user cancels, your code would cancel, too.


> I am curious, if I build a database outside of a project and open it in the main prg, can you use form wizard?
>

Yes, it is not very important to have the DBC in the project.Files collection. Except when you are referncing DBC Stored Procdures, then VFP might insist to have it there.
On the other hand, I'd say almost nobody uses the Form Wizard, because the result is not "perfect".

> What is your methodology for data sourcing in your forms and reports?
>

What methodology do you mean besides the ones we were talking about?


hth
-Stefan



COMPLETE THREAD
Can't access vfp database on server Posted by Mark Buckley @ 11/12/2008 11:43:44 PM
RE: Can't access vfp database on server Posted by Stefan Wuebbe @ 11/12/2008 11:53:09 PM
RE: Can't access vfp database on server Posted by tushar @ 11/13/2008 8:16:32 AM
RE: Can't access vfp database on server Posted by Mark Buckley @ 11/13/2008 5:27:50 PM
RE: Can't access vfp database on server Posted by Benny Thomas @ 11/13/2008 9:01:44 PM
RE: Can't access vfp database on server Posted by Mark Buckley @ 11/13/2008 9:39:13 PM
RE: Can't access vfp database on server Posted by Stefan Wuebbe @ 11/14/2008 6:19:56 AM
RE: Can't access vfp database on server Posted by Mark Buckley @ 11/14/2008 3:22:27 PM
RE: Can't access vfp database on server Posted by Stefan Wuebbe @ 11/14/2008 3:34:57 PM
RE: Can't access vfp database on server Posted by Benny Thomas @ 11/15/2008 5:08:31 PM