Ask a questionAsk a question
 

Answermultiuser environment

  • Wednesday, November 04, 2009 1:49 PMLarry_Nuñez Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    How do I open and close tables for a multiuser environment in vfp 9.0? I don´t use tableupdate() commands. I use update and insert commands to record data. I need to know how to control this.

Answers

  • Wednesday, November 04, 2009 6:15 PMCetinBasozMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    How do I open and close tables for a multiuser environment in vfp 9.0? I don´t use tableupdate() commands. I use update and insert commands to record data. I need to know how to control this.
    You should.

    You would simply use CursorSetProp('Buffering', 5, 'yourAlias') to turn table level optimistic buffering on.

    Here is a very simple single form multiuser application:

    public loForm
    loForm = createobject('myForm')
    loForm.Show()
    read events

    define class myForm as Form
    DataSession = 2 && private data session
    ControlBox=.f.
    Add object btnSave as CommandButton with caption = 'Save', Width = 60
    Add object btnClose as CommandButton with caption = 'Exit', Left = 70
    Add object grdCustomers as Grid with RecordSource = 'Customer'

    Procedure Load
    set exclusive off
    use (_samples + 'data\Customer')
    CursorSetProp('Buffering', 5, 'Customer')
    endproc

    Procedure btnSave.Click
    tableupdate(2,.t., 'Customer')
    endproc

    procedure btnClose.Click
    clear events
    thisform.release()
    endproc
    enddefine


    PS: This is very simple. Read "programming for shared access" section in help. You would need to handle updates differently under different usage scenarios. What I wrote is known as "last write wins" and may not be appropriate for your scenario.

All Replies

  • Wednesday, November 04, 2009 1:55 PMKalpesh Chhatrala Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Check below Link..

    http://www.foxite.com/articles/read.aspx?id=75&document=moving-from-single-user-to-multiuser-in-vfp
    Please "Mark as Answer" if this post answered your question. :)

    Kalpesh Chhatrala | Software Developer | Rajkot | India

    Kalpesh's Blog
  • Wednesday, November 04, 2009 2:02 PMdni Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Just put in init event of you main form or at beginning of your mai program SET EXCLUSIVE OFF AND SET MULTILOCKS ON..
    dni
  • Wednesday, November 04, 2009 3:57 PMLarry_Nuñez Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I understand that for a mutiuser environment I need to put my dataenvironment tables in buffering #5 optimistic table. When i do this my forms open well for mutiuse but my data doesn´t record. I use the update command and insert command. Also i don´t understand how other forms open well after this and the tables aren´t buffered to optimistic table. Confused is what I am, help me please.

  • Wednesday, November 04, 2009 4:04 PMdni Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    You may need to use tableupdate() to update buffered tables ...
    dni
  • Wednesday, November 04, 2009 6:15 PMCetinBasozMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    How do I open and close tables for a multiuser environment in vfp 9.0? I don´t use tableupdate() commands. I use update and insert commands to record data. I need to know how to control this.
    You should.

    You would simply use CursorSetProp('Buffering', 5, 'yourAlias') to turn table level optimistic buffering on.

    Here is a very simple single form multiuser application:

    public loForm
    loForm = createobject('myForm')
    loForm.Show()
    read events

    define class myForm as Form
    DataSession = 2 && private data session
    ControlBox=.f.
    Add object btnSave as CommandButton with caption = 'Save', Width = 60
    Add object btnClose as CommandButton with caption = 'Exit', Left = 70
    Add object grdCustomers as Grid with RecordSource = 'Customer'

    Procedure Load
    set exclusive off
    use (_samples + 'data\Customer')
    CursorSetProp('Buffering', 5, 'Customer')
    endproc

    Procedure btnSave.Click
    tableupdate(2,.t., 'Customer')
    endproc

    procedure btnClose.Click
    clear events
    thisform.release()
    endproc
    enddefine


    PS: This is very simple. Read "programming for shared access" section in help. You would need to handle updates differently under different usage scenarios. What I wrote is known as "last write wins" and may not be appropriate for your scenario.