p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer (http://p2p.wrox.com/forumdisplay.php?f=574)
-   -   Lesson 38 Build Customer Database (http://p2p.wrox.com/showthread.php?t=91300)

John S October 29th, 2013 02:32 PM

Lesson 38 Build Customer Database
 
Page 424 has a notation box on how to build a SQL database called Customer.mdf, for people who have access to SQL Server.

The book calls it a "program", so I was expecting an .exe, but instead it is a Solution. You load the solution into Visual C#, and then run it.

That's fine, but I had to overcome a few problems. For one, when running the solution you get a text box asking where the SQL server is located, but you have to figure out that that is what the text box is asking.

It's just a text box that says "GOTHMOG./SQLExpress" , and a button labeled Create Database.

You have to figure out how to change it to the path to your own SQL server.

This may have been covered in the book before, I don't remember. But as I have SQLExpress loaded on this computer, I was able to change the path to just :

./SQLExpress

and it worked.

However, once the Customer database was created, I could not attach to it. Windows 7 gave me the error message that I did not have permission to open the file, and that I needed to contact the owner of the file.

I had to go through the complicated process of Taking Ownership of the file, and once having done that, had to Allow Full Permissions to my username.

However, after doing all this, I was still unable to attach the database. The new error was that I did not have permission to open the LOG file! I had to go back and go through the whole Take Ownership process AGAIN to give myself permission (on MY OWN COMPUTER!!) to open the database log file!!

After doing so, the database was accessible to Lesson 38, Exercise 2.

What a nightmare!

Rod Stephens October 29th, 2013 02:57 PM

Hi John,

Sorry that one was such as hassle.

The permission issues may have been caused by the fact that you downloaded files from the internet. Different versions of Windows handle this is different ways but the more recent versions flag the file as suspicious. Then programs like Visual Studio simply refuse to open them instead of telling you what the problem is. Sorry you have to figure that out for yourself.

Re. program versus solution. Technically a Visual Studio solution includes one or more projects, which are usually assemblies. Most of my solutions (in the book and for my own use) contain a single project. You can open a project instead of the solution that contains it, but if the solution only contains one project it doesn't matter much.

If by "program" you meant a compiled executable, I never provide those for download so they can never be infected with viruses.

Sorry getting SQL Server to work was hard. I find it (and all database programming) has a few things like the connection string that are just plain cryptic. (I think both this and the file ownership issues get worse with every new version of Windows and Visual Studio.)

Hopefully others will benefit from your explanation about using ./SQLExpress, and your other comments about taking ownership of files.

Sorry again that this was such an ordeal.


All times are GMT -4. The time now is 01:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.