Can MSSQL do what foxpro did in terms of record locking? if so? How?. Tnx
Can MSSQL do what foxpro did in terms of record locking?
Collapse
X
-
Since this is the Microsoft SQL Server forum, you can't expect us to know what foxpro did in terms of record locking. You will have to tell us what it did and we can tell you if there's similar functionality.
You should be aware though that foxpro is more like Microsoft Access, combining a database engine with a front end interface. Whereas Microsoft SQL Server is just the database engine.
Therefore, if what you want to accomplish is a front end issue, that is not something that Microsoft SQL Server can accomplish. -
Sir, I am just concert with the data i currently working with hundreds of table.
What I want to do is to avoid duplication and handles those error.
in foxpro simply,
Code:FUNCTION get_referenceNo() DO WHILE .t. nLAstno = 1 SELECT tbl_setup SET ORDER TO tag intcode IF SEEK('001') DO WHILE .t. IF RLOCK() nLastno = tbl_setup.lastno REPLACE tbl_setup.lastno WITH nLastno + 1 UNLOCK EXIT ENDIF ENDDO ENDIF SELECT tbl_itinerary SET ORDER TO tag itineraryno IF !SEEK(nLAstno) EXIT ENDIF ENDDO RETURN nLAstno ENDFUNC USing MSSQL I got this Dim rs As New ADODB.Recordset Dim cn As New ADODB.Connection Private Sub Form_Load() cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SubReceiving;Data Source=.\SQLEXPRESS" End Sub Function get_referenceNo() Do While True Set rs = Nothing rs.Open "select lastno from tbl_setup where intcode='001'", cn, adOpenStatic nLastno = 1 If rs.RecordCount > 0 Then nLastno = rs.Fields("lastno") cn.Execute "update tbl_setup set lastno=" & nLastno + 1 & "" End If Set rs = Nothing rs.Open "select * from TBL_ITINERARY where ITINERARYNO=" & nLastno & "", cn, adOpenStatic If rs.RecordCount = 0 Then Exit Do End If Loop get_referenceNo = nLastno End Function
if i were maybe lock those record, I will add another loop so other workstation will block untill the one who lock the record
releases.
I badly need suggestion..tnxComment
-
Locking is mostly done automatically but you can use the HOLDLOCK and ROWLOCK hints to force and hold a lock until your transaction is committed.
The sys.dm_tran_loc ks procedure will tell you about currently active requests to the lock manager for a lock that has been granted or is waiting to be granted.Comment
Comment