 |
BOOK: Beginning ASP.NET 4.5 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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
|
|
|
|
|

March 17th, 2014, 01:55 AM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Got stuck at chatper 13 - pg458
Hi Imar,
Thanks for the wonderful book. It was very straightforward and enjoyable to read.
I am currently working on chapter 13 and I have stumbled on the connection task between the Database and the Site. In step 6, I was unable to connect the database. The error was "Unable to open the physical file "C:\BegASPNETVB\Site\App_Data\PlanetWrox.mdf". Operating system error 5: "5(Access is denied.)".
An attempt to attach an auto-named database for file C:\BegASPNETVB\Site\App_Data\PlanetWrox.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. "
I tried to use the Modify connection and locate the Database at the same location but encounter this error "You don't have permission to open this file. Contact the file owner or an administrator to obtain permission".
The machine I am using is Win 7. This is my personal laptop so my log in account should have the administrator status. This error doesn't make sense and I need your help.
Can you please let me know what to do next?
Thanks
-Au
|
|

March 17th, 2014, 05:49 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Quote:
|
so my log in account should have the administrator status
|
Should have? Or does have? Have you tried running Visual Studio as an administrator? To do this, right-click the Visual Studio shortcut on the Start Menu and choose Run As Administrator.
Does that make a difference?
Imar
|
|

March 18th, 2014, 03:46 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
I tried to run as Administrator but still encounter the same problem. :(
|
|

March 19th, 2014, 04:46 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
A few questions / things to check:
1. Which SQL Server instance are you using?
2. How does your connection string look?
3. What are the permissions set on the App_Data folder on disk under Windows?
4. What do you see when you log in to SQL Server using SQL Server Management Studio? Is your database listed there?
Cheers,
Imar
|
|

March 21st, 2014, 03:20 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Hi Imar
1. Which SQL Server instance are you using?
The Collation is SQL_Latin1_General_CP1_CLAS
Compatibility level is SQL_Server_2012(110)
2. How does your connection string look?
Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\BegASPN ETVB\Site\App_Data\PlanetWrox.mdf;Integrated Security=True
3. What are the permissions set on the App_Data folder on disk under Windows?
Permission is Read-only
4. What do you see when you log in to SQL Server using SQL Server Management Studio? Is your database listed there?
I see my database here
---
I tried to troubleshoot and it seems like I was able to get on with the exercise. I changed the type of server to Microsoft SQL Server and have got the connection on the .dbo file. However, the .mdf file still shows that it is not connected.
Would you kindly explain what happened? Would the .dbo be better to use or the .mdf will be more suitable?
Thanks Imar, as always.
|
|

March 21st, 2014, 05:13 PM
|
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
|
|
Same Type of Problem
Give This thread a careful read if you've not already done so.
I finally resolved my problems by uninstalling and reinstalling VS & SQL Svr and following Imar's suggestions very carefully. I think it comes down to confusion over instance names - but, I went through this problem some time ago so memory fades.
For what it's worth, I don't use App_Data folder for the DB. I think it's more straight forward to use your own folder and, again, follow Imar's directions for permissions.
Eventually, all these access problems evaporated and were never an issue again.
|
|
The Following User Says Thank You to daveharney For This Useful Post:
|
|
|

March 21st, 2014, 07:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Ah, that might be the issue. Clear the ReadOnly flag on the General tab of the folder's settings, and then under the Security tab, make sure your account has Modify permissions. If it keeps failing, grant the Everyone account full control (temporarily) so you can determine if it's indeed a security issue.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

March 25th, 2014, 03:27 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Imar,
Thanks for the information. I'm progressing well in your book. I hope to finish the book by May.
Dave,
Thanks for helping me understand more about the problem. It's always great to learn from fellow practitioners.
Cheers.
|
|

March 25th, 2014, 03:35 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Dave,
So has the problem been resolved now?
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

March 27th, 2014, 08:22 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thanks. The problem is resolved. The best way is to change the security of the database access in the setting properties in Windows to allow all, like you said.
Thanks
|
|
 |
|