|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
record locking with DBF (visual basic) table in ADO OLEDB in VB.NETwith the Visual Foxpro OLEDB driver (VFPODBC.DLL). Read, write, update, delete all work fine using a dataset. Is there any automatic way to handle concurrent updates to the same record by different users. How would it work? If I had to do it manually I'd use a "last updated" timestamp and do something like this: step 1. Read record without lock step 2. modify record step 3. read same record with lock step 4. compare last updated timestamps step 5. If they match then write the record and release lock step 6. if they don't match then release record lock and disp error msg to user If I did this manually, I still don't know how to do a "read with record lock" to protect the record during that small window between steps 3 and 5. Right now I'm using a dataset to do the update/delete/insert operations then updating the database with a DataAdapter.Update method. I'm open to using another technique if it's required to protect the records from concurrent updates. I heard about something called "pessimistic locking" and "optimistic locking" (or something like that). Would that apply to my case? If so how would it work? I can't imagine this is an unusual requirement... I've never had a problem figuring out record locking in any other programming environment... .NET is very powerful, but it seems like some of what should be easy things, are not very obvious! Thanks, John Sorry for the duplicate post.... got an I/O error on the first one and
thought it didn't get thru "JohnR" <JohnR***@hotmail.com> wrote in message news:GMK1e.23193$Ue6.14492@trndny04...Show quoteHide quote > Hi, in VB.NET I'm accessing a DBF file using ADO with an OLEDB connection > with the Visual Foxpro OLEDB driver (VFPODBC.DLL). Read, write, update, > delete all work fine using a dataset. > Is there any automatic way to handle concurrent updates to the same record > by different users. How would it work? If I had to do it manually I'd > use > a "last updated" timestamp and do something like this: > > step 1. Read record without lock > step 2. modify record > step 3. read same record with lock > step 4. compare last updated timestamps > step 5. If they match then write the record and release lock > step 6. if they don't match then release record lock and disp error msg to > user > > If I did this manually, I still don't know how to do a "read with record > lock" to protect the record during that small window between steps 3 and > 5. > > Right now I'm using a dataset to do the update/delete/insert operations > then > updating the database with a DataAdapter.Update method. I'm open to using > another technique if it's required to protect the records from concurrent > updates. > > I heard about something called "pessimistic locking" and "optimistic > locking" (or something like > that). Would that apply to my case? If so how would it work? > > I can't imagine this is an unusual requirement... I've never had a problem > figuring out > record locking in any other programming environment... .NET is very > powerful, but > it seems like some of what should be easy things, are not very obvious! > > Thanks, John > > > Hi John,
I don't have time to play with this right now, but you can wrap your update in a Transaction and within the Transaction you could do all your checking. I answered a question about Transactions recently; you can read it at http://groups-beta.google.com/group/microsoft.public.dotnet.datatools/browse_frm/thread/be1e5a8924f9247b/c7946cd42abf9a96. As for optimistic and pessimistic locking, if you're referring to those terms in Visual FoxPro, then pessimistic locking locks a record from the time you access it until the time you release it, and optimistic locking only locks the record when it is actually being written. In this case, if another user has modified the record between the time you accessed it and the time you actually wrote your changes, then "the last guy wins" as far as which updates are retained in the end. The VFP documentation says that the VFP OLE DB data provider supports the standard DBPROP_LOCKMODE and DBPROP_LOCKMODES properties. Sorry to say I haven't ever worked with those. This is an interesting question - now you've got me curious to learn exactly how it all works. -- Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP cindy_winegar***@msn.com www.cindywinegarden.com Blog: http://spaces.msn.com/members/cindywinegarden "JohnR" <JohnR***@hotmail.com> wrote in message news:GMK1e.23193$Ue6.14492@trndny04...Show quoteHide quote > ....... > Is there any automatic way to handle concurrent updates to the same record > by different users. How would it work? .......... > I heard about something called "pessimistic locking" and "optimistic > locking" (or something like > that). Would that apply to my case? If so how would it work? ..... Hi Cindy,
Thanks for pointing me in the right direction. My goal for next week is to study the OLEDB documentation. Right now, i've been using oledb on the highest level and it worked well, I just didn't get into the guts of it.... now I will.... John Show quoteHide quote "Cindy Winegarden" <cindy_winegar***@msn.com> wrote in message news:%23YKwRhKNFHA.1176@TK2MSFTNGP12.phx.gbl... > Hi John, > > I don't have time to play with this right now, but you can wrap your > update in a Transaction and within the Transaction you could do all your > checking. I answered a question about Transactions recently; you can read > it at > http://groups-beta.google.com/group/microsoft.public.dotnet.datatools/browse_frm/thread/be1e5a8924f9247b/c7946cd42abf9a96. > > As for optimistic and pessimistic locking, if you're referring to those > terms in Visual FoxPro, then pessimistic locking locks a record from the > time you access it until the time you release it, and optimistic locking > only locks the record when it is actually being written. In this case, if > another user has modified the record between the time you accessed it and > the time you actually wrote your changes, then "the last guy wins" as far > as which updates are retained in the end. > > The VFP documentation says that the VFP OLE DB data provider supports the > standard DBPROP_LOCKMODE and DBPROP_LOCKMODES properties. Sorry to say I > haven't ever worked with those. > > This is an interesting question - now you've got me curious to learn > exactly how it all works. > > -- > Cindy Winegarden MCSD, Microsoft Visual Foxpro MVP > cindy_winegar***@msn.com www.cindywinegarden.com > Blog: http://spaces.msn.com/members/cindywinegarden > > > "JohnR" <JohnR***@hotmail.com> wrote in message > news:GMK1e.23193$Ue6.14492@trndny04... >> ....... >> Is there any automatic way to handle concurrent updates to the same >> record >> by different users. How would it work? .......... > >> I heard about something called "pessimistic locking" and "optimistic >> locking" (or something like >> that). Would that apply to my case? If so how would it work? ..... > >
Only Numeric Values in the textbox
Timer1_Elapsed problem. how to deserialize an array? How can I get the Menuitem 's name ?? ListViewImageList keeps bitmap locked after disposing what if the database connection isn't close sqlreader Do...while problem Search and Replace using WildCards add-in missing from toolbar. FileSystemWatcher to FileSystemIgnorer |
|||||||||||||||||||||||