Home All Groups Group Topic Archive Search About

removing a connection to a sql server database.

Author
16 Nov 2005 9:53 PM
Chris
Hi,

I posted this in the sql forum but I think this place is more appropriate.

I've written a vb.net windows appication that allows a user to run DTS
packages on a remote SQL 2000 Server.

The program runs the DTS packages in a sequence.

The DTS package that fails is a simple delete database process.
Drop databasename;

However before I delete the database I perform the following on the database.

  Dim Conn As SqlConnection = New SqlConnection(ConnectionString)
            Conn.Open()
            DO some stuff
            Conn.Close()
            Conn.Dispose()
            Conn = Nothing

I then run my executeDTSPackage code and it fails.
It fails because there is a connection existing with the database.

What other code do I need to add to obliterate any connection still existing?

Note: the executeDTSPackage works If I don't open up a connection to the
database.

Thanks

Chris

Author
21 Nov 2005 1:23 AM
Robbe Morris [C# MVP]
http://www.eggheadcafe.com/forums/ForumPost.asp?ID=46053&INTID=9

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net





Show quote
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:4AC75EDB-AC3A-46FF-BAE4-25597087BCD6@microsoft.com...
> Hi,
>
> I posted this in the sql forum but I think this place is more appropriate.
>
> I've written a vb.net windows appication that allows a user to run DTS
> packages on a remote SQL 2000 Server.
>
> The program runs the DTS packages in a sequence.
>
> The DTS package that fails is a simple delete database process.
> Drop databasename;
>
> However before I delete the database I perform the following on the
> database.
>
>  Dim Conn As SqlConnection = New SqlConnection(ConnectionString)
>            Conn.Open()
>            DO some stuff
>            Conn.Close()
>            Conn.Dispose()
>            Conn = Nothing
>
> I then run my executeDTSPackage code and it fails.
> It fails because there is a connection existing with the database.
>
> What other code do I need to add to obliterate any connection still
> existing?
>
> Note: the executeDTSPackage works If I don't open up a connection to the
> database.
>
> Thanks
>
> Chris

AddThis Social Bookmark Button