Jump to content

Cannot add a new Database to my project in Visual Studio 2008

Nick0318's Photo
Posted Dec 16 2009 09:17 AM
5540 Views

I am new to C# and Visual Studio and going thru the HeadFirst C# text. I followed the instructions to add a Service Based Database (Page 18) and recieved message: "Connection to SQL Server files(.mdf) requires SQL Server Express to function properly. The message is followed by a link where to download server express. I have SQL server express installed. I can sign on to SQL server manager no problem. I can view other databases I downloaded no problem ie. AdventureWorks and Northwind. I can also connect to these databases (thru VS 2008) no problem. I also tried to create the required databese in SQL Server Manager. However when I tried to connect to this new database, Database was in use.

What is my problem???

Tags:
0 Subscribe


1 Reply

0
  AndrewStellman's Photo
Posted Dec 24 2009 08:20 AM

Wow, sorry about that! It sounds like you're doing everything right. You seem to have drawn the short straw -- there were a few people who ran into similar troubles with SQL Server Express. We made a post on the Head First Labs forum about it:

http://forums.oreill...-in-chapter-1-/

We're busily working on the second edition of Head First C# -- last night I was just working on the new version of chapter 1. Luckily, the beta version of Visual Studio 2010 now supports local databases using SQL Server Compact Edition (*.sdf files), which are generally less problematic and (I believe) don't depend on SQL Server Express. I think this will make everyone's life easier.

You can download the Visual C# Express 2010 beta here if you want to take a look:

http://msdn.microsof...o/dd582936.aspx

You can give chapter 1 a shot in VS2010 Beta using a local database, if you're brave. I can't promise anything, but if I can get chapter 1 in reasonable shape in the near future, I'll work with the O'Reilly folks to put out a PDF of the draft, just to give you (and anyone else running into the same problem) a helping hand. I'll make sure to post about it in the forum if/when we do that (which will hopefully be soon!).

Luckily, there's nothing in chapter 2 that depends on what you do in chapter 1 -- you start with entirely new projects. So if you absolutely can't get it working, and you don't feel like trying your luck with the VS2010 beta, you can skip to chapter 2 without any trouble.

I hope this helps!