Solved

Design Issue with Database Access

Posted on 2006-07-19
1
206 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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