none
Visual foxpro programming

    Question

  • I have design an enrollment system in stand alone application.
    This time I wanted to convert it into a network environment with 2 to 3  computer using the application and one server.

    Please help me.

    Thanks

    Melquiades p. Gerez

    Philippines

    Friday, January 20, 2012 2:06 AM

Answers

  •  

       MR .P.Gerez  :

           Py adding  to previous  recommendations  by craig,olaf,Namoi

            read the the help of  Oepn dabase  command  in help  it is as followes. and programming in shared environments

    OPEN DATABASE Command

    Example   See Also

    Opens a database.

    Syntax

    OPEN DATABASE [FileName | ?]
      [EXCLUSIVE | SHARED]
      [NOUPDATE]
      [VALIDATE]

    Arguments

    FileName

    Specifies the name of the database to open. If you don't specify an extension for the file name, Visual FoxPro automatically assigns a .dbc extension. If you omit FileName, the Open dialog box is displayed. You can specify a path name as part of the database name.

    Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

    ?

    Displays the Open dialog box from which you can choose an existing database or enter the name of a new form to create.

    EXCLUSIVE

    Opens the database in exclusive mode. If you open the database exclusively, other users cannot access it and will receive an error if they try to gain access. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

    SHARED

    Opens the database in shared mode. If you open the database for shared use, other users have access to it. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

    NOUPDATE

    Specifies that no changes can be made to the database. In other words, the database is read-only. If you omit NOUPDATE, the database is opened with read/write access.

    Tables contained in the database are not affected by NOUPDATE. To prevent changes to a table in the database, include NOUPDATE in USE when you open the table.

    VALIDATE

    Specifies that Visual FoxPro ensures that references in the database are valid. Visual FoxPro checks to see that tables and indexes referenced in the database are available on disk. Visual FoxPro also checks to see that referenced fields and index tags exist in the tables and indexes.

    Remarks

    While the database is open, all tables contained in it are available. However, the tables are not implicitly opened. You must open them with USE.

    When USE executes, Visual FoxPro looks for the table within the current database. If the table isn't found, Visual FoxPro then looks for a table outside the database. This means that if a table in a database has the same name as a table outside the database, the table in the database is found first.

    You cannot open a database that has been opened exclusively by another user.

     


    azizsallam
    Saturday, January 21, 2012 3:12 PM
  • Thanks Michael

     

    This actually saved me from asking this question as I am prepared to compile my first Multi-User App. I also found some useful/helpful information

    here http://www.foxite.com/articles/read.aspx?id=75&document=moving-from-single-user-to-multiuser-in-vfp

     

    Sunday, January 22, 2012 9:56 PM
  • I usually have a text file called dataloc.txt which contains the path to the data, such as s:\myapp\data\ . When your application starts, you open the text file and store the path to a variable. When opening your files, use the variable to find the data.

    * inside your startup .prg:
    
    if file("dataloc.txt")
       handle1=fopen("dataloc.txt")
       if handle1 < 0
          =messagebox("Cannot Open 'DATALOC.TXT'. Shutting Down...",64,"SYSTEM")
          return
       else
          datapath=addbs(alltrim(fgets(handle1)))
          =fclose(handle1)
       endif
    else
       =MESSAGEBOX("Missing Data Path file 'DATALOC.TXT'.",64,"SYSTEM")
       return
    endif
    
    * to open a file, do the following:
    USE datapath+"myfile.dbf" IN 0 shared


    You can make the code better by testing to make sure the path exists, and other issues such as file is exclusively locked, etc... but this should at least get you going.

    HTH


    Mike z
    Saturday, January 21, 2012 3:16 PM

All replies

  • Hi 

    First read in VFP Help Topic "Shared Access" 

    It will help to you startup your application.

     

    Kalpesh


    Please "Mark as Answer" if this post answered your question. :)

    Kalpesh Chhatrala | Software Developer | Rajkot | India

    Kalpesh 's Blog

    VFP Form to C#, Vb.Net Conversion Utility
    Friday, January 20, 2012 5:12 AM
  • thank you sir for the answer of my question and for giving ideas, I have read the "Shared Access"

    and I have already applied  command such as set exclusively Locking Data, etc..... my problem sir is the connection on how I can share the database and application in different terminals.. My program was designed for a single user only but I wanted to share this application to a multi-user. I hope you get what I mean.......

    Thank you sir in advance for helping me

    Melquiades P. Gerez

    Philippines 

    Saturday, January 21, 2012 1:24 PM
  •  

       MR .P.Gerez  :

           Py adding  to previous  recommendations  by craig,olaf,Namoi

            read the the help of  Oepn dabase  command  in help  it is as followes. and programming in shared environments

    OPEN DATABASE Command

    Example   See Also

    Opens a database.

    Syntax

    OPEN DATABASE [FileName | ?]
      [EXCLUSIVE | SHARED]
      [NOUPDATE]
      [VALIDATE]

    Arguments

    FileName

    Specifies the name of the database to open. If you don't specify an extension for the file name, Visual FoxPro automatically assigns a .dbc extension. If you omit FileName, the Open dialog box is displayed. You can specify a path name as part of the database name.

    Note   Visual FoxPro will not recognize a path name properly if a disk or directory name contains an exclamation point (!).

    ?

    Displays the Open dialog box from which you can choose an existing database or enter the name of a new form to create.

    EXCLUSIVE

    Opens the database in exclusive mode. If you open the database exclusively, other users cannot access it and will receive an error if they try to gain access. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

    SHARED

    Opens the database in shared mode. If you open the database for shared use, other users have access to it. If you do not include EXCLUSIVE or SHARED, the current SET EXCLUSIVE setting determines how the database is opened.

    NOUPDATE

    Specifies that no changes can be made to the database. In other words, the database is read-only. If you omit NOUPDATE, the database is opened with read/write access.

    Tables contained in the database are not affected by NOUPDATE. To prevent changes to a table in the database, include NOUPDATE in USE when you open the table.

    VALIDATE

    Specifies that Visual FoxPro ensures that references in the database are valid. Visual FoxPro checks to see that tables and indexes referenced in the database are available on disk. Visual FoxPro also checks to see that referenced fields and index tags exist in the tables and indexes.

    Remarks

    While the database is open, all tables contained in it are available. However, the tables are not implicitly opened. You must open them with USE.

    When USE executes, Visual FoxPro looks for the table within the current database. If the table isn't found, Visual FoxPro then looks for a table outside the database. This means that if a table in a database has the same name as a table outside the database, the table in the database is found first.

    You cannot open a database that has been opened exclusively by another user.

     


    azizsallam
    Saturday, January 21, 2012 3:12 PM
  • I usually have a text file called dataloc.txt which contains the path to the data, such as s:\myapp\data\ . When your application starts, you open the text file and store the path to a variable. When opening your files, use the variable to find the data.

    * inside your startup .prg:
    
    if file("dataloc.txt")
       handle1=fopen("dataloc.txt")
       if handle1 < 0
          =messagebox("Cannot Open 'DATALOC.TXT'. Shutting Down...",64,"SYSTEM")
          return
       else
          datapath=addbs(alltrim(fgets(handle1)))
          =fclose(handle1)
       endif
    else
       =MESSAGEBOX("Missing Data Path file 'DATALOC.TXT'.",64,"SYSTEM")
       return
    endif
    
    * to open a file, do the following:
    USE datapath+"myfile.dbf" IN 0 shared


    You can make the code better by testing to make sure the path exists, and other issues such as file is exclusively locked, etc... but this should at least get you going.

    HTH


    Mike z
    Saturday, January 21, 2012 3:16 PM
  • Thanks Michael

     

    This actually saved me from asking this question as I am prepared to compile my first Multi-User App. I also found some useful/helpful information

    here http://www.foxite.com/articles/read.aspx?id=75&document=moving-from-single-user-to-multiuser-in-vfp

     

    Sunday, January 22, 2012 9:56 PM
  • also read in VFP help topic "set exclusive on/off" Rlock() & flock() 
    • Proposed as answer by Aanish Friday, May 31, 2013 5:26 AM
    • Unproposed as answer by Aanish Friday, May 31, 2013 5:32 AM
    • Proposed as answer by Aanish Friday, May 31, 2013 5:33 AM
    • Unproposed as answer by Aanish Friday, May 31, 2013 5:33 AM
    Tuesday, January 22, 2013 10:33 AM
  • hi Melquiades,

    Y can make u r application with in a network like u share the drive in which u r application there and amp that drive in other system as Z, Y anything , and just create a shortcut and run u r application in any of the systems

    regards 

    Anish

    Friday, May 31, 2013 5:38 AM