Sql Update/insert
-
Having a client who connects to servers automatically and insert data in a DB. and in the same time.. having a user who works on these data,update and delete them... i m afraid , that these 2 process run in the same time. and worried about the data (insert and update in the same time) note the Database is SQL Server Xpress Edition Do you think Sql lockes the Tables while working on them ? is there a way to lock the tables? for not using them with 2 process?
Regards Ramy
-
Having a client who connects to servers automatically and insert data in a DB. and in the same time.. having a user who works on these data,update and delete them... i m afraid , that these 2 process run in the same time. and worried about the data (insert and update in the same time) note the Database is SQL Server Xpress Edition Do you think Sql lockes the Tables while working on them ? is there a way to lock the tables? for not using them with 2 process?
Regards Ramy
Good question :) Actually SQL server waits for each connection session to to be done for database and then it updates the database with the change. However, when you deal with ADO to access a database to perform any action such as DELETE, UPDATE, etc., you should consider in opening the database with pesimistic or optimistic locking methods. I have given a sample below. If Response.IsClientConnected = True Then Set ObjectRecord = Server.CreateObject ("ADODB.Recordset") ObjectRecord.CursorLocation = adUseServer ObjectRecord.CursorType = adOpenkeyset ObjectRecord.LockType = adLockOptimistic ObjectRecord.Open GetTableName, ObjectConnection,,,adCmdTable 'adcmdtext for SQL Query End If I hope that helps :wtf: Journey