Andrea, thank you for the help; actually, I am using ADO.
"Andrea Montanari" wrote:
> hi William,
> William GS wrote:
> > Hello, how can I lock a record? it must be modified only for one user
> > at the same time.
>
> probably it depends on the object model you use to access your data...
> ADO supports a pessimistic lock when you open a server side connection
> (.CursorLocation = adUseServer) and set the .LockType = adLockPessimistc
> property of a recordset object.. as no .Edit property is available in ADO
> model, the record itself gets locked when you access it for midification, ie
> when you set objRS.Fields(0).Value = objRS.Fields(0).Value which actually
> does nothing but trying (and an exception is raised if it fails) to lock the
> row by modifying it...
> this does not work with ADO.Net as no pessimistic lock is available so you
> have to rely on SELECT lock hints,
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_7a_1hf7.asp ,
> but it is quiet difficult to hold such locks for a coffee break duration (an
> ipotetic employee's break :D) ...
> you should try to modify your design in order to use the "new" standards to
> not to lock a resource until needed (UPDATE/DELETE/INSERT actual moment),
> and this is quiet transparent to you as it is well performed by SQL Server
> it self..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
>
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org > DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> --------- remove DMO to reply
>
>