.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Santhakumar Munuswamy
Post New Web Links

MS SQL Server: Disconnect Users From Database - Kill User Session

Posted By: Faizal     Posted Date: November 08, 2009    Points: 2   Category :ASP.Net
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

View Complete Post

More Related Resource Links

Checking SQL Server User Roles and Creating SQL Server Users using VB.NET

Hello gurus!Firstly I want to apologies if this question is out of place here.. if someone can direct me to the correct forumn great and Thanks!I have a VB.NET application which uses its own Backend Database (MSSQL Server). I need to distribute this application to sites where there will be an existing SQL Server.So I will need to Create the Database on this server. The Application includes methods for building the database on startup if not already connected to one.However the users windows logon may not have the correct permission to connect and create a Database on the Server. I have a DB Setup form in my application which asks for the Servname, Username, Password and Database name. I have catered for Windows Authentication and SQL Server Authentication within the form - the user makes the choice.Assuming they enter a Username and Password for SQL Server Athentication then I will be trying to connect using this user and create the database on the given server. The following is my outline logic:-                                                                  Create db Process                                                                             |                                                                             |                                                               Check Credentials                                                                   / 

SharePoint 2010 Server: Cannot manage all user profiles from upgraded MOSS SSP database

I have upgraded an SSP database to SharePoint 2010 and successfully performed User Profile Synchronization with Active Directory, however I cannot manage ALL of the user profiles in the database. I go to "Manage User Profiles" in Central Administration and perform a filtered search (i.e. I want all DOMAIN accounts beginning with "j" so I search for "DOMAIN\j" in Manage User Profiles), but I don't receive ALL the user profiles back. I receive about 8 in return when I know there are about 20 starting with "j". If I create a new AD account beginning with "j" it is successfully synched with SharePoint 2010 and I see it in the Manage User Profiles. I ran an stsadm -o sync to clear any old synchronization information, and the Forefront Synchronization Service appeared to pull in many changes to existing accounts (including ones I can't currently manage), but I still cannot manage them using "Manage User Profiles". I really need to be able to manage all the profiles so I can manually edit some fields. Can anyone please help? Thanks in advance.

disconnect all the users from database


Hi gurus

Is there any command to disconnect all the users from the database. I don't want to set it in single user mode.



disconnect from SQL Server 2008 DataBase




In My WPF application I'm connecting to SQL server 2008 dataBase.

i want to give the users the option to restore the dataBase, when I'm trying to disconnect, and restore, i get the message saying that the restore failed due to the fact that it doesn't exclusive access.


I tried executing the command:


and now i can't access it at all...

1. how can i kill all the connections to the dataBase for restore?

2. How can i cancel this ALTER command?




Restoring a content database from another server/AD does not synch user profile information for new


In my SharePoint 2010 beta environment, I have user profiles synching with Active Directory.  I just restored a content database from a separate environment/domain and logged in with my current account.  When I try to create an alert on a library/item, I get the error:

“You do not have an e-mail address.  Alert has been created successfully but you will not receive notifications until valid e-mail or mobile address has been provided in your profile.”

I went to My Profile and found that the My Profile had the right e-mail address (I guess because this is on my My Site Host).

But when I went to My Settings, it did not have any e-mail address for me (I guess this is because it is at the WSS content database level and the e-mail address hasn’t yet synched from the user profile database).

Does anyone the timer job that synchs the user profile with the My Settings for a site collection in a content database?

Issue is posted to my blog with screenshots here:



SQL Server 2000 Database in "single user mode"


Hi all,

I've an old production database server with SQL Server 2000 SP4, that runs from 6 years. Now sometimes I find that the production database goes in "single user mode". Why? My error logs don't help me.

create database trigger to capture new session users



I would like to capture the session user names of people connecting to our database and store them in a separate table.

I was hoping I could "create trigger foo on database for logon". But that is only valid for server based triggers. The problem is I know adding a server based trigger might upset some of our database guys so ideally I would like to avoid this option if possible.

Does anyone have any suggestions?

Thanks in advance



assign different asp pages to users with different user types (database used is ms access)



hello.. i'm a bit stuck with my project and i hope anyone out there could lend a hand.. im completely new to asp.net so please bear with me.. =)

i have a table in ms access where i have username, password and usertype.. i wanted to use that table so that when i log in, the user with the "admin" usertype will go to the admin page while the user with the "user" usertype will go to the members page.. i can log in so the only issue is how to redirect them to their respective pages.. any help would be appreciated.. =)

Is realtime SQL Server Replicated database usable realtime (not offline / single user mode)


Is SQL Server replicated (destination) database replicated by SQL Server Replication fully usable? Meaning it's not just for Disaster Recovery but is fully usable from various say BI / Reporting purposes.

In the essence it is exactly same as other replication engines and the destination database is very much usable and not just offline / single user mode.



Deny certain user from deataching a certain database in sql server 2005

How can i deny a certain user from detaching certain database in sql 2005 ?
for example denying sa from detaching adventureworks

Best Regards,

Kill session when user closes the browser



I have a requirement from client that to show the concurrent users.

They are using one username and password at different instances. As we need to track the concurrent users, I have wriiten in Global.asmx file for Session_start and session_End , But still showing a differentt result.


So, we have choosen database and when the user logins successfully , count is tracked in the database. And when user loguts count is decreased.

But, we are facing a problem like when user closes the browser how can we end the session and decrease the count in the database. And if be abruptly when he closes the browser or if session gets timed out count should be decreased.

how do you determine if a user is connecting to your SQL database with built in SQL server driver ve

An upgrade to our company's software requires SQL Native Client & I want to see if anyone is still not using the SQL Native Client. Didn't know if there was a way to monitor this server side

How to add a user DSN for SQL Server Compact Edition Database File (filename.sdf)

I'm very new to database operations, so bear with me.
I have a SQL Server Compact Edition Database File (filename.sdf).
I can connect to this database file (filename.sdf) using MS SQL Server 2008 with server type set to SQL Server Compact Edition. I can select data and do queries.
But in order to connect to the database file from National Instruments LabWindows CVI, I have to create a User DSN under my ODBC Data Source Administrator.
None of the samples represents a *.sdf file.
I clicked on Add and get a window called Create New Data Source.
I am asked to Select a driver for which you want to set up a data source.
I tried the SQL Server option, but that did not seem to work.
The database connectivity test always fails.
Is there a better driver with which to communicate with a sdf file?

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Server Database Transaction

A transaction is a group of SQL commands executed together as a single component of work to be accomplished. If all of these commands succeed, then a transaction is committed - the changes to the data are made final. If any of the commands within a transaction fail, then the entire transaction is cancelled, or in SQL Server terms, the transaction will be rolled back.

Transactions are one of the things that keep your data safe, but they're not necessarily easy to understand. Here's some help:

Configuring User Profiles in SharePoint Server 2010

Note: I've added the necessary links relating to SharePoint Server 2010 prerequisites, along with instructions for configuring the user profile synchronization service, at the end of this
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend