Professional Web Applications Themes

Heeeeeelp: Prevent to Drop the Databse - Microsoft SQL / MS SQL Server

I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error "-2147217900 (80040e14) can not drop the database, it is currently in use....." How do I prevent this? Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?...

  1. #1

    Default Heeeeeelp: Prevent to Drop the Databse


    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Bauji Guest

  2. #2

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted to single-user mode?

    What database? Sounds like SQL Server?

    ON a side note ......why would you ever want to 'drop' the database?

    Chris.
    "Bauji" <com> wrote in message news:e%phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Chris Guest

  3. #3

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    No I dont want to kill all the spides, I want to gove error message to that
    person who is trying to delete database.

    "Anith Sen" <com> wrote in message
    news:phx.gbl... [/ref]
    >
    > You can use sp_who /sp_who2 system procedures. Or you can query the
    > master..sysprocesses table to see the current connections.
    >
    > To remove them, you can either kill all the spids in a loop or you can do
    > the popular method :
    >
    > ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    >
    > --
    > - Anith
    > ( Please reply to newsgroups only )
    >
    >[/ref]


    Bauji Guest

  4. #4

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    I'm sorry I have no idea of how to achieve this from a client app - I'm talking from a sys admin point of view using the SQl Server 2000 MMC Console to place the db into single user mode to do admin tasks on it.

    Chris.

    "Bauji" <com> wrote in message news:phx.gbl...
    I am using sql server 2000.

    Actually it is multicompany application, and database is created by the name of company code. I am allowing the user to deleting database and I just want take the precaution, if someone delete the shared database so an eror message should display.

    How do I know that database in single-user mode? Is there any way of any command?

    "Chris Barber" <co.uk.NOSPAM> wrote in message news:phx.gbl...
    You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted to single-user mode?

    What database? Sounds like SQL Server?

    ON a side note ......why would you ever want to 'drop' the database?

    Chris.
    "Bauji" <com> wrote in message news:e%phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Chris Guest

  5. #5

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.

    -regards, -marty nicholson
    "Bauji" <com> wrote in message news:e#phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?







    Martin Guest

  6. #6

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    Dear

    whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

    Ash

    "Martin Nicholson" <com> wrote in message news:%235W$phx.gbl...
    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.

    -regards, -marty nicholson
    "Bauji" <com> wrote in message news:e#phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Bauji Guest

  7. #7

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    You already have the appropriate error number:

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    Chris.
    "Bauji" <com> wrote in message news:%phx.gbl...
    Dear

    whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

    Ash

    "Martin Nicholson" <com> wrote in message news:%235W$phx.gbl...
    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.

    -regards, -marty nicholson
    "Bauji" <com> wrote in message news:e#phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Chris Guest

  8. #8

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    But it did not work every time
    "Chris Barber" <co.uk.NOSPAM> wrote in message news:%phx.gbl...
    You already have the appropriate error number:

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    Chris.
    "Bauji" <com> wrote in message news:%phx.gbl...
    Dear

    whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

    Ash

    "Martin Nicholson" <com> wrote in message news:%235W$phx.gbl...
    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.

    -regards, -marty nicholson
    "Bauji" <com> wrote in message news:e#phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Bauji Guest

  9. #9

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    Why would you want to give USERS the ability to drop databases?!?!

    Personally, I would implement a system whereby a user could mark
    a database as being suitable for deletion; then implement scheduled
    code on the server that dropped marked databases if appropriate...


    "Bauji" <com> wrote in message news:phx.gbl...
    I am using sql server 2000.

    Actually it is multicompany application, and database is created by the name of company code. I am allowing the user to deleting
    database and I just want take the precaution, if someone delete the shared database so an eror message should display.

    How do I know that database in single-user mode? Is there any way of any command?

    "Chris Barber" <co.uk.NOSPAM> wrote in message news:phx.gbl...
    You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted
    to single-user mode?

    What database? Sounds like SQL Server?

    ON a side note ......why would you ever want to 'drop' the database?

    Chris.
    "Bauji" <com> wrote in message news:e%phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a
    single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop
    the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message
    accordingly?







    Daniel Guest

  10. #10

    Default Re: Heeeeeelp: Prevent to Drop the Databse

    Therein lies the problem - dropping a multi-user databse is a sysy admin function, not really a user function.

    As Daniel says - mark it and then deny users accessing it at the client code. You could implement a periodic check to see if its in use and notify when there are no connections and so allow the 'drop' at that time.

    Sorry I can't really help you with the T-SQL - grab a copy of SQL Server Books Online and check out ALTER etc.

    Chris.
    "Bauji" <com> wrote in message news:%23UQ%phx.gbl...
    But it did not work every time
    "Chris Barber" <co.uk.NOSPAM> wrote in message news:%phx.gbl...
    You already have the appropriate error number:

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    Chris.
    "Bauji" <com> wrote in message news:%phx.gbl...
    Dear

    whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

    Ash

    "Martin Nicholson" <com> wrote in message news:%235W$phx.gbl...
    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.

    -regards, -marty nicholson
    "Bauji" <com> wrote in message news:e#phx.gbl...

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?






    Chris Guest

Similar Threads

  1. What is the best databse to use and why?
    By Jerry C. in forum ASP Database
    Replies: 15
    Last Post: June 23rd, 06:43 AM
  2. Question - heeeeeelp
    By EmmaB in forum Macromedia Flash
    Replies: 1
    Last Post: February 4th, 07:37 PM
  3. Replies: 2
    Last Post: August 22nd, 09:37 PM
  4. Replies: 3
    Last Post: July 9th, 12:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139