SitePoint Sponsor

User Tag List

View Poll Results: Have you had this problem?

Voters
1. You may not vote on this poll
  • Frequently

    0 0%
  • Sometimes

    0 0%
  • Once

    0 0%
  • Never

    1 100.00%
Results 1 to 13 of 13
  1. #1
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation 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?

    Thanks.

    Chris
    Attached Files Attached Files

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Did you try refreshing the tree before posting polls and screenshots?

    PS: knowing the exception could help explain things.

  3. #3
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Code HTML4Strict:
     
    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.

    Thanks again.

    Chris
    Attached Files Attached Files

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    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.

    Thanks.
    Chris
    Attached Images Attached Images

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Well, the aspnet account is "special" and I'm not sure what you did here. One question--where are you storing the .MDF file?

  7. #7
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    The path to my database is: C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Decatur.mdf

    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.

    Although I don't think its browser related, I didn't want to leave anything to chance; I am testing the website on IE8RC1, Mozilla Firefox 3.0.6, and Google Chrome. My machine used Windows XP SP3. IE and Google Chrome return the same error message. Mozilla Firefox returns Runtime Error referencing to create a <customErrors> tag.

    Thanks again.

    Chris

    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.
    Attached Files Attached Files

  8. #8
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Well, the aspnet account is "special" and I'm not sure what you did here. One question--where are you storing the .MDF file?
    I think I figured it out and I am going to post the information. I now know what I should do, but want to understand what the code that I wrote was telling my web app.

    Thanks.

    Chris

  9. #9
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    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.

    Thanks again.

    Chris

  10. #10
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You changed the location it was looking for the database. Nothing crazily fancy nor rocket sciencish.

  11. #11
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    You changed the location it was looking for the database. Nothing crazily fancy nor rocket sciencish.
    Thanks for your help on this. I really appreciated it.

    For the time I was trying to work on this, I don't think I will do it again. Hopefully the pdf upload will help if by some outside chance someone runs into a similar issue.

    Chris

  12. #12
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh, I've done that same thing.

  13. #13
    SitePoint Zealot cruncher06's Avatar
    Join Date
    Feb 2009
    Location
    Illinois, USA
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad to see I'm not the only one prone to breaking things.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •