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 January 3rd, 2012, 03:50 PM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default Chap. 12 & open of .mdf database

In VS 2010, I'm trying to open the .mdf file supplied in chapter 12 by copying the file to App_Data and double clicking it (tried other ways also) and getting an error basically saying that opening this SQL database requires SQL Server 2005-8 Express to be installed and running on the local computer. When I recently upgraded VS 2005 to 2010 (full product) apparently it kept SQL Server 2005 and I want 2008 version. So I downloaded SQL Server 2008 R2 Express and installed it. I uninstalled 2005 version. The config mgr says it is up and running. I can use the Svr Mgt Studio to create a test DB.

I used Windows Explorer to insure that I have full permissions on the App_Data file created in the web site I created for this exercise. My normal userid on this computer (Win 7) is also an administrator for the PC.

If I try to open the .mdf file by connecting to a database in the VS Server Explorer sometimes I get an error 5 - access denied - but not always. Although, oddly, I have sometimes opened the DB this way and could see the tables - but I'm not able to move the DB to the App_Data folder.

I'm also not able to open the .mdf DB in the Svr Mgt Studio and the error is not clear to me. BTW, the "user instance" (in the advanced tab) was already set to false - something mentioned in other advice about this type of problem.

Obviously there is something about this that I don't have set up correctly.

Thanks for your help.
 
Old January 4th, 2012, 08:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
So I downloaded SQL Server 2008 R2 Express and installed it. I uninstalled 2005 version.
If you did it in this order, your new 2008 Rs instance will not be called .\SqlExpress as that name was already taken by the 2005 installation. The trick is to find out the instance name of your SQL Server which you can do by looking at the SQL Server Configuration Manager.

Also, make sure you're not attaching the database to SQL Server using Management Studio *and* try to access it thorugh the App_Data folder. Each option keeps a lock on the database which prevents the other from accessing the files. So, either use App_Data, or use a folder outside your web site's folder such as C:\Databases.

Cheers,

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Single database for ASPNETDB.mdf and database.mdf grouchy ASP.NET 4 General Discussion 9 August 29th, 2011 05:40 PM
Database Copy paste .MDF & .LDF Issue anup.maverick SQL Server 2005 1 May 13th, 2011 07:10 AM
can't open aspnet.mdf database file moulot BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 1 October 11th, 2009 07:00 AM
Chap 12, P. 374: How to open 'Package Migrate Wizard' from BIDS? cJeffreywang BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 March 20th, 2009 02:08 PM
how to open database file of .mdf extension ravi.gurgaon BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 19th, 2006 05:09 AM





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