473,563 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using SMO to detach a database

so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatab ase("MyDatabase ");

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

Jun 8 '07 #1
2 5134
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.co m

"Rogelio" <Ro*****@discus sions.microsoft .comwrote in message
news:C2******** *************** ***********@mic rosoft.com...
so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatab ase("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.c omwrote in
message news:B6******** *************** ***********@mic rosoft.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.co m

"Rogelio" <Ro*****@discus sions.microsoft .comwrote in message
news:C2******** *************** ***********@mic rosoft.com...
>so I notice to detach a database you use

Server svr = new Server();
svr.DetachDatab ase("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
15434
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 on here at work where some people think that during the detach, transactions in the log file are saved to the data file. Thanks!
2
1646
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 like to stop debugging without killing the IDE I attached it to. Is that possible? Bob
0
1814
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 am able to call this method from vb.net desktop client and add a record to the database(this I used to test if there is any problem in the...
3
7926
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 underneath that div element. There should be a way for me to just detach my element from document's dom tree and be able to set it into a variable....
1
2749
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 there a way that I can I detach this later via -=, or do I need to use a named event?
8
8812
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 line window running on my Win PC, the python script stops to run too. I tried to use cron tables instead. By setting the time and restart cron...
3
14695
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 need to create another db with the same name. Thanks.
0
1365
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
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.