The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

SQL Server Management Studio Tree within New Database Disappears

I created a database in Microsoft SQL Server Express 2008 and used the information from the book I read from SitePoint - "Build Your Own ASP DOT NET 3 DOT 5 WEB SITE USING C# & VB" (Changed the book name, it was interpreted as a web address). I followed the book to create a site structured the way the book was written and then I created another site.

When I attempt to run my app, the web page crashes. Upon looking at SQL Server Management Studio, I see that my Database is there but the nested controls are gone as in the attached zip file with the name DatabaseTreeMissing.jpg.

I then restore the database and then receive my Database tree looks appropriate like in the DatabaseRestored.jpg.

Upon running the database web page again. Sometimes the tree is affected and sometimes it is not.

Is there something I can look for in the web.config file that's causing this? If not what do I need to do?

I did refresh the tree in SQL Server and there was no change. The database still appeared, but no child elements. I also closed the connection and then reconnected. I then removed the database and then attached it again.

Hoping that it might help, I restarted SQL Server Express, restarted IIS, and checked my project into Visual Source Safe and then checked it back out. No change after that either.

The only way I am able to get my database back is by restoring the backup.
For the error, I set the trace to true and ran the web page again. The exception happens right after Begin PreRender.

For a reference, I have a login page that is set up the same way as it is in Chapter 13 in SitePoint's Book. If you don't have this, as a reference, I used the information in the web.config, which you can find in the attached authentication.txt file. It was used for testing purposes for my web page.

The information on the exception is in the attachement since the exeption messages were interpreted as web pages as well as the authentication information.

Please let me know if there is additional information that would be helpful.

Looks like you might have missed a step--you need to grant that MACHINENAME\aspnet user access to the database. Now, there might well be a bug in SSMS express that you found, but that is a bit of a red herring here.

I opened Microsoft SQL Server Management Studio. Once it was open, I right clicked at the top of the tree and clicked on properties. This brought up the Server Properties dialog box. In the Select a page, I selected on Permissions and then from Logins or roles, I selected MachineName\ASPNET and granted all permissions. I don't know if you should do this, if it's recommended or just unimportant, but I felt that it would eliminate issues on access rights.
Once I granted MachineName\ASPNET. Now I did this at the top level it did work.

Out of curiosity, I opened Microsoft SQL Server Management Studio and attempted to un-collapse the tree, which appeared to be fine, but I received the error message as shown in the file named FailedToRetrieveDataOnAttach.jpg

I realized that you mentioned to grant access to the database itself, so after going through the steps and attaching the database again, I used the same steps to grant access to the database for the MachineName\ASPNET account. Internet Explorer crashes in this situation. When I open SQL Server Management Studio, it also returns that same error message box as reference above, when I attempt to un-collapse the tree.
One last thing to note, MachineName\ASPNET is set up as an administrator on my machine.
I hope I have doing something wrong; itís just a lot easier to fix if thatís the case. However, I have had a knack to find things that donít work in applications.

I have attached the properties for the folder, except for the security tab. Administrators have full access (as I'm sure that you already know), and the ASPNET account isn't listed here, although it is an administrator.

Just an FYI; I tried to open the database once by directly clicking on the icon and meant to select, pick program from a list, but accidentally clicked on Use Microsoft Live Search. Can you believe it, Microsoft Live Search returned extension type .mdf unknown. I would think this would make Microsoft - ; thought it was humurous.

After several tests, I believe this is resolved and have attached documentation to reference what I did. I still would like to know how the machine is reading the code to better understand how it works.