Solved

Design Issue with Database Access

Posted on 2006-07-19
1
202 Views
Last Modified: 2010-04-23
Hi

I have a database that can be accessed at any point in time to retrieve data. The database also periodically gets updated with information from a text file that the program imports.

Is there any nice way to restrict access to the database while the database is been updated and make any other requests wait until it has finished?

Thanks
Adam
0
Comment
Question by:adam_pedley
1 Comment
 
LVL 6

Accepted Solution

by:
Nandakumar Sakthivel earned 500 total points
ID: 17136863

If you want to stop accessing the Tables for the particular table means you can acheive this by using transaction objects
using  "SqlCon.BeginTransaction(IsolationLevel.RepeatableRead)"


       Dim sqlCmd As SqlCommand
       Dim SqlCon As SqlConnection
       Dim trans As SqlTransaction

            SqlCon = New SqlConnection("")
            SqlCon.Open()
            sqlCmd = New SqlCommand
            trans = SqlCon.BeginTransaction(IsolationLevel.RepeatableRead)
            sqlCmd.CommandTimeout = 0
            sqlCmd.Connection() = SqlCon
            sqlCmd.CommandType = CommandType.Text
            sqlCmd.Transaction = trans
     
It is a way called pessimistic locking

http://builder.com.com/5100-6388-1049842.html

Thanks,
Nanda
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now