Hi All,

I have a working VB routine which will detach and re-attach a given database using SQL DMO objects.

But I am hoping to add checks to handle 'Database in Use' errors when I detach. Is there a way in DMO to check for any active connections to the database and then safely drop all connections (so I can proceed to detach)?

I have found the SQLDMO.Database.EnumLocks() method but am not sure if this applies.

Any insight is much appreciated. Thanks in advance!