Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2004, 06:03 AM
bsa bsa is offline
Registered User
 
Join Date: Aug 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exclusive ADO Connection

Hi,

I'm trying to open a SQL Server database exclusively using ADO. I'm setting the mode property of the connection to adModeShareExclusive as follows:

cn.Mode = adModeShareExclusive
cn.Open strCnn

Unfortunately, other users are still able to connect to the database. Does anyone have a solution to this ?

This property works well with MS Access but not with SQL Server.

Waiting for an early reply.


BSA

 
Old September 6th, 2004, 07:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

A SQL Server connection is made to the database server, unlike Access where a connection is made to a single database, so this connection mode cannot be supported in SQL Server (OK you can specify the initial db in the conn string, but no locks are created at this stage). What you do instead will depend on why you feel you need to shut all other users out of the database entirely. I suggest you start by reading up on transaction support in SQL Server, particularly Isolation Levels.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DAO and ADO within ADODB.connection faridrd Access VBA 0 January 8th, 2008 10:43 PM
Exclusive ADO Connection bsa SQL Server 2000 2 August 24th, 2004 12:10 AM
ADO Connection String jmss66 Classic ASP Basics 3 February 3rd, 2004 12:10 PM
Global ADO Connection object DaveParry123 ADO.NET 0 October 7th, 2003 03:44 AM
ADO connection using password values GLCGLC Wrox Book Feedback 1 August 25th, 2003 10:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.