473,396 Members | 1,997 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,396 software developers and data experts.

How to attach mdf in a relative directory

ad
I use asp.net 2.0 and SqlServer 2005 Express to develop my Web application
The database file of my applicaiton is "db.mdf", I put it in "myDB"
directory under the application folder.

I want to attach the mdf file when application start. How can I do that?
Nov 19 '05 #1
4 3815
What do you want to attach it to?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eX*************@TK2MSFTNGP10.phx.gbl...
I use asp.net 2.0 and SqlServer 2005 Express to develop my Web application
The database file of my applicaiton is "db.mdf", I put it in "myDB"
directory under the application folder.

I want to attach the mdf file when application start. How can I do that?

Nov 19 '05 #2
The mdf file is *already attached*, isn't it ?

Why did you detach it, if you did ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eX*************@TK2MSFTNGP10.phx.gbl...
I use asp.net 2.0 and SqlServer 2005 Express to develop my Web application
The database file of my applicaiton is "db.mdf", I put it in "myDB" directory under the
application folder. I want to attach the mdf file when application start. How can I do that?

Nov 19 '05 #3
ad
I wnat to copy my web applicaiton with .mdf to another machine.
I want that:
If the .mdf is not attatch to database server, it will attached by program
when application start.

How can I do that?
"Juan T. Llibre" <no***********@nowhere.com> ¼¶¼g©ó¶l¥ó·s»D:uv**************@TK2MSFTNGP10.phx.g bl...
The mdf file is *already attached*, isn't it ?

Why did you detach it, if you did ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eX*************@TK2MSFTNGP10.phx.gbl...
I use asp.net 2.0 and SqlServer 2005 Express to develop my Web application
The database file of my applicaiton is "db.mdf", I put it in "myDB"
directory under the application folder.

I want to attach the mdf file when application start. How can I do that?


Nov 19 '05 #4
The usual way to do that is to export the database to a .sql file
and use an installer to re-create the database in the db platform.

The ability to copy databases as files is enabled by default in SSE.

You could also, simply, copy the .mdf file and
use an AttachDBFileName connection string.

See the section titled "Connecting Using AttachDBFilename" at :

http://msdn.microsoft.com/library/de...sesecurity.asp

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I wnat to copy my web applicaiton with .mdf to another machine.
I want that:
If the .mdf is not attatch to database server, it will attached by program when
application start.

How can I do that?
"Juan T. Llibre" <no***********@nowhere.com>
¼¶¼g©ó¶l¥ó·s»D:uv**************@TK2MSFTNGP10.phx.g bl...
The mdf file is *already attached*, isn't it ?

Why did you detach it, if you did ?

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eX*************@TK2MSFTNGP10.phx.gbl...
I use asp.net 2.0 and SqlServer 2005 Express to develop my Web application
The database file of my applicaiton is "db.mdf", I put it in "myDB" directory under
the application folder.

I want to attach the mdf file when application start. How can I do that?

Nov 19 '05 #5

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

Similar topics

15
by: Nick K. | last post by:
I recently began maintenance work on a production web server that is located in the root directory of a web server. I moved this into a sub web on my local web server in order to do work on it. I...
1
by: Alex VanderWoude | last post by:
I am trying to <include> some text into an XML documentation topic, but that text is stored in a file that is in a different directory than the "current" XML file. Using a relative path does not...
7
by: Rizaan Jappie | last post by:
is it possible to get the relative path based on a absolute path in c#? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
6
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data...
4
by: Win, Pats | last post by:
I have a snippet of HTML that I inject into a number of pages throughout my Web site at runtime. My problem is that I'm not getting the image to appear in all documents into which this snippet is...
7
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at...
9
by: Garann Means | last post by:
I have a subfolder under wwwroot set up as a virtual directory with its own application name in IIS. I pulled it down from Visual Source Safe and, on the machine where it's normally hosted, it...
8
by: JJ | last post by:
I'm confused about paths. I have a functionn that uses the mappath method, which I think requires a virtual path (is that the same as a relative path?). But this doesn't always work as the...
2
by: Peted | last post by:
Hi i have a circumstance where a user unzips a file, with a certain layer of directories to get to a textfile. So in any directory on the HDD they may end up with something like ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.