How to Close any opened Connections to a database?
-
Hi everybody, I've made a POS System and @ the exit I want to make an automatic Backup which copies the database to some place ... but it says the database is used ... & I tried to find where it is unclosed (it is thousand of lines of code).... and I cant get it ... so can anybody help me ... how write some line of code which will close any opened connection to that database? .. Thank you
-
Hi everybody, I've made a POS System and @ the exit I want to make an automatic Backup which copies the database to some place ... but it says the database is used ... & I tried to find where it is unclosed (it is thousand of lines of code).... and I cant get it ... so can anybody help me ... how write some line of code which will close any opened connection to that database? .. Thank you
Perhaps Management Studio has the database open? If so, you have to close Management Studio; I don't think you can close another application's connection, at least it shouldn't be your standard operating method.
modified on Thursday, December 3, 2009 2:19 PM
-
Perhaps Management Studio has the database open? If so, you have to close Management Studio; I don't think you can close another application's connection, at least it shouldn't be your standard operating method.
modified on Thursday, December 3, 2009 2:19 PM
I didnt get what you said... Can you elaborate it to me
-
Perhaps Management Studio has the database open? If so, you have to close Management Studio; I don't think you can close another application's connection, at least it shouldn't be your standard operating method.
modified on Thursday, December 3, 2009 2:19 PM
I knew that... but wat i wanted is how to close all connections that are opened @ that time
-
Hi everybody, I've made a POS System and @ the exit I want to make an automatic Backup which copies the database to some place ... but it says the database is used ... & I tried to find where it is unclosed (it is thousand of lines of code).... and I cant get it ... so can anybody help me ... how write some line of code which will close any opened connection to that database? .. Thank you
-
Do you know how to use google? I tried with - "kill connections sql server" and all of the top 10 results had the answer.
-
BUT, to kill connections (not your own) you need sa rights, not something which most accounts should have.
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP
-
Yap, this is true, but if you are building an administrative module you should grant this kind of rights to the admin of the application.
Shorgov wrote:
you should grant this kind of rights to the admin of the application.
Matter of opinion. It allows far to much damage to be done - do you really want to give a user the right to drop tables etc?
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP
-
Shorgov wrote:
you should grant this kind of rights to the admin of the application.
Matter of opinion. It allows far to much damage to be done - do you really want to give a user the right to drop tables etc?
Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP