Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locking records using Select-Sql
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Locking records using Select-Sql
Miscellaneous
Thread ID:
00649340
Message ID:
00649340
Views:
36
Hi people!

I need to lock records in a table using Select - Sql.

I don't use directly the tables, then I can't use RLock() .or. FLock().
For example:
* To read data from the table:
Select * from MyTable Where Codigo = 1 Into Cursor MyCursor
ThisForm.Field1.Value = MyCursor.Field1
ThisForm.Field2.Value = MyCursor.Field2
ThisForm.Field3.Value = MyCursor.Field3
* To save data to the table:
m.Field1 = ThisForm.Field1.Value
m.Field2 = ThisForm.Field2.Value
m.Field3 = ThisForm.Field3.Value
If m.IsInsert
   Insert Into MyTable (Field1, Field2, Field3) Values (m.Field1, m.Field2, m.Field3)
Else
   Update MyTable Where Field1 = m.Field1 Set Field2 = m.Field2, Field3 = m.Field3
EndIf
I have to lock the record as soon as I read data from it. My problem is: I can't have 2 users updating the same record in the same time.

Important: Like I try to explain, I don't use the tables (directly) then I have to LOCK and UNLOCK the record just using SELECT-SQL / INSERT-SQL / UPDATE-SQL and DELETE-SQL.

Is it possible?

Thanks!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Next
Reply
Map
View

Click here to load this message in the networking platform