Re: Help Isolating Data Access

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 06/11/04


Date: Thu, 10 Jun 2004 22:31:17 -0400

Chris:

Do you mean the record on the DB side or locally? If you mean on the db,
I'm not sure I understand. Let's say that I have record with a field called
CustNumber and process one with user Bill is accessing it. I pull the
record down into a dataset. During the select I mark the record as Used to
that the same query run now won't return the record b/c the where clause
specifies "where UsageFlag <> '1'" or whatever you do for indicating used.
Is this the scenario? Or do you mean you have 3 or four processes running
locally? If it's locally than you can sync lock the datatable (or the row)
and be done with it (well, that may be an overstatement, I don't want to
overgeneralize when we're talking about threading).

-- 
W.G. Ryan MVP Windows - Embedded
http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
"Chris Gallucci" <chris@gallucci.com> wrote in message
news:eZfkGjyTEHA.2416@TK2MSFTNGP12.phx.gbl...
> I need help with what I think may be a design issue.
>
> I need to access a record for processing. I need to do it in such a
fashion that several concurrent processes do not access the same
> record.
>
> I've set up a stored procedure that first queries the table for a record
to process than marks the record so that it is now
> unavailable.
>
> The process that executes this stored procedure runs on multiple threads
on multiple machines.
>
> My problem is that I have occasions where two or more threads access the
same record at the same time which causes unwanted
> redundant processing. IOW, I need to be able to guarantee that a record
will never be processed by more than a single thread of
> execution.
>
> Does anyone have a solution or suggestion? Is there a design pattern for
this?
>
> FWIW, the parent process is a Windows Service written in C#.NET (v1.1)
running against a SQL Server 2000 database.
>
> ChrisG
>
>
>


Relevant Pages

  • Help Isolating Data Access
    ... I need help with what I think may be a design issue. ... The process that executes this stored procedure runs on multiple threads on multiple machines. ...
    (microsoft.public.dotnet.general)
  • Re: Help Isolating Data Access
    ... What if the stored procedure does the update and checks for the update count ... to determine if it was successful. ... > The process that executes this stored procedure runs on multiple threads ...
    (microsoft.public.dotnet.distributed_apps)
  • SqlDataAdapter.Fill returns results of previous command
    ... This code executes successfully at certain points in the application, ... I don't know what the cause of this exception is yet, ... stored procedure was indeed executed on the database. ... The trace shows that the last action on the db was the stored ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Tracing user & permissions (triggers and stored p)
    ... To solve my problem I chosed to configure the SQL ... > from xp_cmdshell executes under the security context of the SQL Server ... >> sql Trigger executes a Stored Procedure passing it some variables. ...
    (microsoft.public.sqlserver.security)
  • Re: Stored Procedure slow when called from Crystal Reports
    ... Access executes ... that statement to my stored procedure that is executed by the report, ... report runs about 3 times faster - almost as fast as the SP on its own. ... Yes, it is slow the first time, but that's before ...
    (microsoft.public.vb.crystal)

Quantcast