Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2010, 10:36 AM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default Moving DB to App_Data Folder

I am attempting to migrate from Access 2007 to SQL server express. I have researched how to do this and I am able to successfully do this conversion. When I open SQL Server Express my database is present as well as all the data.

When working with databases per this book, we are instructed to move the database to the App_Data folder. I cannot find my SQL Server database anywhere on my computer. It appears to be accessible by SQL Server express, but hidden for other uses. How do I get around this problem?
 
Old November 23rd, 2010, 12:36 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You have at least two alternatives:

1) use the database attached to SQL Server Express. For information about changing your connection string, check out Appendix B

2) Detach the database and then move it to App_Data and update your connection string. To see where the physical files are located before detaching, open the properties dialog for your database in SQL Server Management Studio and look in the File category. In the Path column you see the folder where the file are stored. Then close that dialog, right-click your database and choose Tasks | Detach.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
demac3 (November 23rd, 2010)
 
Old November 23rd, 2010, 02:35 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Thank you! That worked perfectly - I used the detach concept.
 
Old November 24th, 2010, 07:11 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Scenario one is usually the best choice in production. It's better to have a quality database server managing your databases and simply use a connection string to have your application on the server connect to the DB on the DB server. However, this is usually a more expensive option in hosting and you don't always have that option. Even if you do, you'll need to be able to upload and download data between your local instance of SQL Server Express and the production database or the two will quickly get out of synchronization, and that's usually a more difficult development scenario than putting together a synchronization procedure.

If you don't have that option, scenario two is the easier and cheaper scenario although it means one server will be managing both the application and the database which is difficult if you need the performance. However, the .mdf file, once in your App_Data folder is easy to copy up and down from the server like any other file making synchronization a snap, and you can set the connection string to work off the database directly from the App_Code folder which makes development and production simple to manage.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter11 The SQL database file cannot be created in App_Data folder clark BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 January 15th, 2009 10:29 AM
SQL 2005 Express DBs in MSE or App_Data/db Explore cJeffreywang SQL Server ASP 0 February 13th, 2008 10:32 PM
Can't access local file in App_Data folder VictorVictor ASP.NET 2.0 Professional 8 January 23rd, 2007 10:15 AM
Visual Studio 2005 App_Data DB to SQL Chuck_aa ASP.NET 2.0 Basics 5 August 30th, 2006 07:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.