473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using SMO to detach a database

so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatabase("MyDatabase");

but is there a way you can set where its saved after detaching ? thansk

Jun 8 '07 #1
2 5129
Detaching a database doesn't save anything about it. It simply removes
the database from the server. You will have to get the properties of the
files that make up the database before you detach it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rogelio" <Ro*****@discussions.microsoft.comwrote in message
news:C2**********************************@microsof t.com...
so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatabase("MyDatabase");

but is there a way you can set where its saved after detaching ? thansk
Jun 9 '07 #2
Detach is not actually removing anything like database. Files are staying in
the same folder where they were created. Just server forgets about these
files and ignores them on subsequent runs. That's why Nicholas mentions you
need to find out where files are residing before detaching. See ,mdf and ldf
files in BOL. Usually they are in Data subfolder of installation path.

HTH
Alex

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:B6**********************************@microsof t.com...
Detaching a database doesn't save anything about it. It simply removes
the database from the server. You will have to get the properties of the
files that make up the database before you detach it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rogelio" <Ro*****@discussions.microsoft.comwrote in message
news:C2**********************************@microsof t.com...
>so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatabase("MyDatabase");

but is there a way you can set where its saved after detaching ? thansk


Jun 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DBA | last post by:
If I detach a database on a server, then attach the database with a single file only using the data file...will I lose any transactions that were in the original log file? There is a debate going...
2
by: Bob | last post by:
Sometimes I get some odd design-time exceptions that are useful to troubleshoot by attaching the debugger to devenv.exe itself and breaking on CLR exceptions... works well but when I'm done I'd...
0
by: Sathya | last post by:
Hi, I have a vb.net webservice which takes XMLDocument as a parameter and returns bool. Signature of the method is some thing like this AddXmlEmpDetails(xmlEmp as XMLDocument) as Boolean. I...
3
by: Siah | last post by:
Hi, I'd like to detach some of my dom elements and cache them in an object. My current options are to cache its innerHTML, or create an independent 'div' element and move the element as a child...
1
by: Barry Mossman | last post by:
Hi, is it possible to detach an event which is implemented via an anonymous method. ie. If the code is: myObject.myEvent += delegate(object sender, EventArgs e) { // snip event actions } is...
8
by: Ulysse | last post by:
Hello, I have a python script which runs all the time (using of library threading). I would like this scipt to run on a remote linux Os using Putty. The problem is, when I close Putty command...
3
by: rdraider | last post by:
Everything I read about sp_resetstatus says you must restart SQL after. Is there a way around that (don't want to shut down production). The suspect db is just an empty db that is not needed. I...
0
by: aboutjav.com | last post by:
Hi, How do I attach the .mdf and .ldf with the SQL Server Management Studio Express? Do I attached all 4 files? MyWebSiteName_log.LDF MyWebSiteName.mdf ASPNETDB.MDF aspnetdb_log.ldf
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.