CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: table locking

  1. #1
    Join Date
    Sep 2001
    Posts
    254

    table locking

    I have written app using sql server as backend, it just a simple reporting,
    i have created a X table to store data taken from various table and use the X table as source for reporting, if one user is accessing the x table to generate report its 100% Ok, but if by change another user generate a report using X table as well, user 1 extracted data is being included in user 2 extracted data.

    How can i prevent other user to access the table until the fist user has completed his report.

    i've tried adlockpessimistic and open static not working

    tnx
    cyrus

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: table locking

    Do you mean to say that you dump the data into a table X when a user requests a report? If that is the case then you will have this kind of problem where data would be stale or not correct for most of the cases when concurrent users use your tool. And this is the not the right way to write a reporting app.

    The correct way would be to dump all records into one table and then query from this table. You could use a nightly job to dump all your reporting data into a single table, or you can run the job at regular intervals. If you are using SQL 2005, you could also try looking into partitioning. You could also use a simple view.

    I am not sure about your requirement, if this doesn't help you, could you elaborate on what exactly ou are trying to do.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: table locking

    Add two more fields. One for EMP# that can view, and also a DELETE flag, so you know when to do garbage collection.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Feb 2008
    Location
    Bangalore
    Posts
    149

    Re: table locking

    Have you ever tried Table Type of Data in SQL Server?
    Encourage the efforts of fellow members by rating

    Lets not Spoon Feed and create pool of lazy programmers

    - ComIT Solutions

  5. #5
    Join Date
    Sep 2001
    Posts
    254

    Re: table locking

    Quote Originally Posted by Shuja Ali View Post
    Do you mean to say that you dump the data into a table X when a user requests a report? If that is the case then you will have this kind of problem where data would be stale or not correct for most of the cases when concurrent users use your tool. And this is the not the right way to write a reporting app.

    The correct way would be to dump all records into one table and then query from this table. You could use a nightly job to dump all your reporting data into a single table, or you can run the job at regular intervals. If you are using SQL 2005, you could also try looking into partitioning. You could also use a simple view.

    I am not sure about your requirement, if this doesn't help you, could you elaborate on what exactly ou are trying to do.

    Following ur suggestion problem has been resolve,by maintaining the query for selection criteria of data to be reported.

    thnks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured