Home All Groups Group Topic Archive Search About

Detach sql files on closing?

Author
10 Jan 2007 7:12 AM
mtczx232
Detach sql files on closing?

a)I have App that connect directly to SQL files (*.mdf). I realize that
this connection Attach the files to SQL server. How I can force Detach
mdf on closing program?

b)also I try add to project SQL DataBase but I got error that I not
have SQL Express. but I have Developer SQL 2005!?

Author
10 Jan 2007 3:53 PM
dsandor
Hi,

a) I am assuming this is a Windows Forms application..?  If I am correct,
use the Form's Closing event to run an sp_detatch_db procedure.  That should
detatch your mdf files for you. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_da-di_83fm.asp

b) Visual Studio integrates with MS Sql Server Express in order to provide
you with the 'direct access to mdf file' functionality.

-David Sandor

Show quote
"mtczx***@yahoo.com" wrote:

> Detach sql files on closing?
>
> a)I have App that connect directly to SQL files (*.mdf). I realize that
> this connection Attach the files to SQL server. How I can force Detach
> mdf on closing program?
>
> b)also I try add to project SQL DataBase but I got error that I not
> have SQL Express. but I have Developer SQL 2005!?
>
>

AddThis Social Bookmark Button