If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Lock Table Syntax in C# ASP.NET

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-11, 05:56
justy justy is offline
Registered User
 
Join Date: Jul 2011
Posts: 1
Lock Table Syntax in C# ASP.NET

Hello,

I've been looking in the net but I can't find the syntax of locking a table in Access. My purpose is to lock the table so no one else during the transaction can have access to it. I have tried this query

LOCK TABLE [document_numbers] IN EXCLUSIVE MODE

and this

SELECT *
FROM [document_numbers]
WITH (TABLOCK)

and ROWLOCK also but nothing works. The syntax I found is only about MS SQL, Oracle and some more but there is nothing about MS Access. Please if some one knows to post a replay, I will be really grateful.

Greets

P.S. This have to be able to be programmed in C#.
Reply With Quote
  #2 (permalink)  
Old 07-21-11, 06:22
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
Quote:
P.S. This have to be able to be programmed in C#.
probably best to ask this in the C# forum
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 08-21-11, 19:16
jbedson jbedson is offline
Registered User
 
Join Date: Dec 2009
Posts: 46
private static string constr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Mode=Share Exclusive;User Id=admin;Password=";

In the connection string you want to use the "Mode=Share Exclusive;" parameter. This should allow you to do what you want.

I got this from the google webs. Here's the url.

Access Connection String Samples - ConnectionStrings.com

Hope this helps

Jim
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On