Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failure of 'USE' in a windows vfp service 1

Status
Not open for further replies.

alan232

Programmer
May 19, 2004
144
0
0
US
Hi All;

When converting a vfp 6 application into a windows service, I found that execution of 'use...' and 'used...' fail.

'Used...' results in a wrong answer and 'use...' causes the service to go into nether land.

All work well when not within a service call.

Any help will be appreciated,
Thanks,
Alan
 
Hi All:

Hint: if I run the program directly from the VFP desktop, 'use...' and 'used...' fail. i.e.,
!net start myservice
fails.

But, if I run it as a service at boot-up starting automatically, it seems to work.

Any ideas?
Alan
 
Additionall thoughts,

The problem may be simply that the VFP desktop (and code run via the desktop) cannot access tables being used concurently via the service (even though they are opened as non-buffered and shared), e.g., 'Used()' fails to report the tables in action (as they are in a different data space?) yet 'Use()' fails because the tables are already in use.

Comments? Anyway around this?
Alan
 
Are you using the full path name? Maybe even a UNC name?

Also, you will definitely need some sort of error handler. Any sort of UI message will hang the app, since there is no UI from a service.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Dave;

Yes. I'm using a full path name. (What is 'UNC' ?)

(I've created an error handler of sorts by having the service write to a log file--crude, but it works).

Thanks again,
Alan
 
I had an ASP issue with VFP 6.0 sp5 as described in thread1253-812213 and my problem was described as a known bug here too:
BUG: ON ERROR Does Not Trap "Alias Not Found" Error

While my problem is probably not yours, keep in mind that the newer versions of VFP are much more advanced and much more reliable as well. Even though VFP 6 was considered the first solid version, VFP 9 is so much better! So part of the question should be, is this a problem with my own code or an issue with my version of VFP? (I don't have that answer, sorry.)

dbMark
 
In my initial test configuration, the 'service' is started at boot up using the local disk drive, c:. Then I was opening a vfp window to see if I could find the tables opened by the service--no go. The are no blanks in the dbf calls. Oh, I am using VFP 6.0 SP5--I've long considered upgrading if the newer versions would offer significantly more--This maybe my wake up call.

Thanks, I obviously need to investigate further--I'll report my findings,
Alan
 
Hi dbMark:

That is pretty close to exactly what's happening--thanks for the info. Still though, that doesn't say why the alias isn't found, or how to get arround it.

Thanks much,
alan
 
Just a SWAG, but if you are running this as a service, have you granted permissions to open the tables?

Ken
 
I'm with Ken. This could be a rights issue. The service will run under the System account.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
I had a similiar problem. Although 'USE' from the command window would not access a file opened by the service, setting datasession=2 in the service did let the command window access the tables correctly.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top