I have an application (VS2005, C#) that creates one or more SQL Server
Express (2005) databases and populates them with a schema and some
initial data. This all works.
From time to time there is a legitimate runtime issue that means I
should remove one of the newly created databases. The problem is that
the DROP DATABASE XXX command, which I execute from a new connection via
an admin login on the master database, fails with the error "Cannot drop
database "XXX" because it is currently in use.".
I have checked with "sp_who" and there are no active connections to the
database, but there are a couple of 'sleeping' connections, which I
presume belong to the connection pool.
If I wait for some period of time, the sleeping connections disappear
and the DROP DATABASE command then succeeds.
What is the simplest mechanism for permitting me to drop the database
without waiting for the connection pool to expire on its own?
-ken
Hi Ken,
ALTER DATABASE SomeDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
DROP DATABASE SomeDatabase
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||I actually found another method that works as well -- I simply use the
SqlConnection.Clear(specificConnection) to remove the entries from the
pool, and this seems to work.
-ken
Jens wrote:
> Hi Ken,
> ALTER DATABASE SomeDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
> GO
> DROP DATABASE SomeDatabase
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
Showing posts with label vs2005. Show all posts
Showing posts with label vs2005. Show all posts
Friday, March 9, 2012
DROP DATABASE problem
Labels:
application,
creates,
database,
databases,
drop,
microsoft,
mysql,
oracle,
populates,
schema,
server,
serverexpress,
someinitial,
sql,
vs2005
Sunday, February 19, 2012
Drillthrough Event not getting fired
Hi,
I am using VS2005 and SQL Server 2005 reporting Services. I have created a server report (rdl file) and wish to implement drillthrough functionality. On my web page, I added a reportviewer control and added an "OnDrillThrough" Event to the reportviewer.
However, when I click on the element that should raise the drillthrough event, the page gets posted back but the drillthrough event does not get called at all?? Am i missing something?
Thanks
Dabi
Hi Dabi,
I have the same problem as you posted with the drillthrough and I didn't find yet a solution. Can you help me please with it if you found a solution to it?
thanks,
Hanin
Subscribe to:
Posts (Atom)