Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to deal with FoxUser.dbf problems?
Message
 
 
To
11/01/2008 13:53:01
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01281191
Message ID:
01281217
Views:
10
Thank you.

>Just realized I didn't get the vars right, you can try this I think:
>
>lcRecAlias = ALIAS()
>SELE 0
>lcResource = sys(2005)
>IF TYPE('gcUserId') = "C" AND !EMPTY(gcUserId)
>      lcNewResource = 'usr_'+ALLTRIM(LOWER(gcUserId))+'.dbf'
>ELSE
>      lcNewResource = 'usr_'+SYS(2015)+'.dbf'
>ENDIF
>lcRecNewAlias = LEFT(lcNewResource,AT('.',lcNewResource)-1)
>IF !DIRECTORY('c:\foxtmp')
>      TRY
>            MKDIR c:\foxtmp
>      ENDTRY
>ENDIF
>IF DIRECTORY('c:\foxtmp')
>      lcNewRes = ADDBS(JUSTPATH('c:\foxtmp\'))+lcnewresource
>ELSE
>      lcNewRes = 'c:\'+lcnewresource
>ENDIF
>IF EMPTY(SYS(2000,lcNewRes))
>      TRY
>          CREATE TABLE (lcNewRes) FREE (Type C(12), ID C(12), Name M, ReadOnly L, CkVal N(6,0), Data M, Updated D)
>      ENDTRY
>      IF USED(lcRecNewAlias)
>            USE IN (lcRecNewAlias)
>      ENDIF
>ENDIF
>TRY
>      SET RESOURCE TO (lcNewRes)
>      SET RESOURCE ON
>CATCH
>      SET RESOURCE OFF
>ENDTRY
>
>
>>Thank you very much for the code and suggestion.
>>
>>>I keep a copy of a dummy foxuser.dbf that is stored on the network. When the user logs into the app, I create a file name like "tch_user.dbf" or something like that. Then, if that file does not exist in the user's local directory we store temp files to, I create it from that dummy foxuser.dbf (you could do this completely in code) and set the resource to that file.
>>>
>>>Some samples:
>>>(Not tested - but you should be able to go from here)
>>>
>>>lcResource = gcuser + '_user.dbf'
>>>lcNewResource = ADDBS(JUSTPATH(lctemploc))+lcResource
>>>lcRecNewAlias = LEFT(lcNewResource,AT('.',lcNewResource)-1)
>>>IF EMPTY(SYS(2000,lcNewRes))
>>>      TRY
>>>          CREATE TABLE (lcNewRes) FREE (Type C(12), ID C(12), Name M, ReadOnly L, CkVal N(6,0), Data M, Updated D)
>>>      ENDTRY
>>>      IF USED(lcRecNewAlias)
>>>            USE IN (lcRecNewAlias)
>>>      ENDIF
>>>ENDIF
>>>TRY
>>>      SET RESOURCE TO (lcNewRes)
>>>      SET RESOURCE ON
>>>CATCH
>>>      SET RESOURCE OFF
>>>ENDTRY
>>>
>>>
>>>>Thank you very much, Tracy.
>>>>
>>>>On your 3rd point (special foxuser.dbf named after the login name), how do you do it?
>>>>
>>>>>You can turn it off (set resource off in code or resource = off in config.fpw)
>>>>>You can use one on the local drive (resource = c:\myapptempfolder\foxuser.dbf in the config.fpw)
>>>>>You can use a special foxuser.dbf named after the login name of the user or workstation name or whatever as well and that can be located on the network or on the local drive.
>>>>>
>>>>>
>>>>>>I am looking for suggestions to deal with foxuser.dbf problems. Every once in a while customers get error something to the extend of program not being able to read foxuser.dbf. It usually crashes the system. The foxuser.dbf typically (in how I install the application) reside on the shared drive on the server.
>>>>>>
>>>>>>My questions are:
>>>>>>
>>>>>>1. Can I disable my application to use FoxUser.dbf at all? Is it a good idea (if possible)?
>>>>>>2. Can I place the FoxUser.dbf on the local drive? Is it a good approach?
>>>>>>3. What else can I do?
>>>>>>
>>>>>>Thank you in advance for any suggestions.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform