Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 August 14th, 2007, 10:20 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sma_Soft Send a message via Yahoo to Sma_Soft
Default Detach an in-use database via code

Hi all
I want to detach a SQL Server 2000 database using code in C#.
I know what should I do, all I have to do is to call a stored-procedure named sp_detach_db
But the problem occurs when I want to detach it while it's already in use.
As you might have seen, in SQL Server Enterprise Manager when you want to detach a database, there is a "Clear" button which you can use it to disconnect all connected users to that database, and next detach it.
You can see it from this picture:
http://i12.tinypic.com/4rb0rio.jpg
Or:
http://www.sooti.ir/images/SQLClearButton.JPG

Now, what I want is to simulate pressing the Clear button by programming !
In fact, I want to disconnect any previously connected users to my database. Just like what SQL Server Enterprise Manager does.
Is there any solution?
Thanks All !






Similar Threads
Thread Thread Starter Forum Replies Last Post
Creation of Database tables from code... TomW Visual Basic 2008 Essentials 11 February 29th, 2008 03:08 PM
Attach/Detach Component AccessAasif@aol.com C# 2005 0 December 7th, 2007 04:17 PM
Help with code to filter through database. malhyp Dreamweaver (all versions) 4 May 27th, 2006 02:44 AM
Code to Detach Tables SerranoG Access VBA 1 February 9th, 2006 06:15 PM
code doesn't update database Lesviper Beginning VB 6 1 February 7th, 2005 10:18 AM





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