Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Dexter Carlit
  Where is Dexter Carlit?
 Cabanatuan
 Philippines
 Dexter Carlit
 To: Martin Sellwood
  Where is Martin Sellwood?
 Maidstone, Kent
 United Kingdom
 Martin Sellwood
 Tags
Subject: RE: how to lock a table,row in SQL server from VFP
Thread ID: 104068 Message ID: 104121 # Views: 2 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Friday, August 11, 2006 5:18:03 PM         
   


> > Dear Sir,
> > Please clarify some points.
> >
> > > you could create a locking table, containing keyfield,username,datetime
> > What does keyfield here mean? It will hold only fields that are part of a primary key?
> >
> > > when you want to edit the main record
> > Do you mean the time when I click the SAVE button to do TABLEUPDATE(), or the time I started to change the field value, for example, changing a customer's last_name from Smith to Kent?
> >
> > Another question is the one Tushar raised: how to delete the lock records after a disconnection happens?
> >
> > Regards,
> > Nilson

>
> the keyfield is the primary key of the table you want to edit.
>
> in my data forms i have an edit button,
> which when clicked
> 1) checks the lock_table using the primary key of the record i am editing
> 2) if there is no record i add a record to the lock table.
> if there is a record show a message to the user and come out
> 3) refreshes the record i am currently viewing
> ( if the user has been looking at it for a long time, the data may have changed on the backend )
> 4) enables the textboxes,combo's and editboxes etc
> 5) change the edit button to a save button
>
> when the user clicks on the save button
> 1) update the main table using all the normal checks
> 2) remove the record from the locking table
> 3) disable the textboxes,combo's and editboxes etc
> 4) change the save button to an edit button.
>
> if the user crashes whilst in edit mode it will leave a record in the lock table, but you can build a maintenance form to allow the clearing of these. This is where the datetime column comes in, so you can check how long the locking record has been on.



For alternative solutions if you have locked records you can go directly
to the SQL Server Application and connect to you main database, create a new query statement then use the following command below.

* Display All Active, Runnable, Sleeping or Locked Records

sp_who2

* Kill Process
Kill [SPID]

Regards,

Zed

ENTIRE THREAD

how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 3:20:15 AM
RE: how to lock a table,row in SQL server from VFP Posted by Ken Murphy @ 8/11/2006 4:47:44 AM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 5:07:11 AM
RE: how to lock a table,row in SQL server from VFP Posted by Andy Kramek @ 8/11/2006 11:39:06 AM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 4:31:02 PM
RE: how to lock a table,row in SQL server from VFP Posted by Andy Kramek @ 8/11/2006 7:42:52 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/12/2006 5:21:05 AM
RE: how to lock a table,row in SQL server from VFP Posted by Andy Kramek @ 8/12/2006 1:38:26 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/12/2006 5:39:49 PM
RE: how to lock a table,row in SQL server from VFP Posted by Andy Kramek @ 8/12/2006 9:55:28 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/13/2006 5:14:59 AM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 4:47:07 PM
RE: how to lock a table,row in SQL server from VFP Posted by Martin Sellwood @ 8/11/2006 11:55:11 AM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 2:22:22 PM
RE: how to lock a table,row in SQL server from VFP Posted by tushar @ 8/11/2006 2:37:23 PM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 3:55:07 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 5:15:22 PM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 5:52:49 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 6:15:35 PM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 8:09:02 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/12/2006 5:31:24 AM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/12/2006 9:28:20 AM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/12/2006 5:44:43 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 4:44:27 PM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 4:52:50 PM
RE: how to lock a table,row in SQL server from VFP Posted by Martin Sellwood @ 8/11/2006 5:04:19 PM
RE: how to lock a table,row in SQL server from VFP Posted by Dexter Carlit @ 8/11/2006 5:18:03 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 5:47:53 PM
RE: how to lock a table,row in SQL server from VFP Posted by Nilson Rishi @ 8/11/2006 5:41:32 PM