Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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
 
Old January 3rd, 2012, 11:52 PM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Hi,

I'm having the exact problem as Ken and have tried to follow all of your suggestions with no luck. A couple of things I tried:

- no, I can't create a DB in the App-Data folder - keeps telling me I need SQL 2005 or 8 installed and running (which it is)

- In the server mgt studio I can create data bases, put in cols,etc with no problem. I donw loaded some MS sample DB and they also work fine. However, I can't open the WROX db and get the same error Ken noted. I put the planetwrox.mdf in a folder as you suggested and fiddled with permissions per ch 19 & B (as best I could) and still no luck.

- emptied the SQLEXPRESS (and also deleted later) folder. No luck.

- the sql config utility shows my name as MSSQLSERVER (no SQLEXPRESS) - I've used .\MSSQLSERVER in the options -> database of VS2010 (full product) and also changed the web.config file in the web site to show this in the connection string.

- I have rebooted computer. Been at this for a couple of days now - I am slowly going crazy! I can't quite figure out what ken did to get this going.
 
Old January 4th, 2012, 08:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

When you log in to SQL Server Management Studio, what's the name of the server listed in the "Server Name" text box? Maybe it's just a dot (.) or your computer name? You could try that in the connection string and see if that works. You can also set the default instance name in Visual Studio used for the database under Tools | Options | Database Tools | Data Connections. If you're using a default instance (e.g. a dot or the name of your computer) you can leave the field empty.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 4th, 2012, 08:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I put the planetwrox.mdf in a folder as you suggested
Did you put it under a folder that is out side your Documents? E.g. something like C:\Databases? And did you try granting full control to Everyone temporarily to see if that works?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 4th, 2012, 01:23 PM
Authorized User
Points: 267, Level: 5
Points: 267, Level: 5 Points: 267, Level: 5 Points: 267, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 56
Thanks: 17
Thanked 2 Times in 2 Posts
Default

Hi Dave,
Sorry but I can't remember what I did last year to "solve" the problem.

However, I recently had a related problem and had quite a debate on the SQL Server forum. Here is the link to the thread:
http://social.msdn.microsoft.com/For...5-e619a458e085

As you will see the "problem" seems to be due to the fact that the VS 2010 developers use a different naming "standard" from the SQL Server folks.
Here is my summary of the problem from my most recent post on the SQL Server Forum.
===========================
Why did I have so much trouble? - Here are some reasons...
1: I didn't realise that VS 2010 Pro automatically installed a build of SQL Server.
Thus, I had two SQL Server builds installed and running but, since I carefully set this lot up from scratch on a clean hard drive, I thought that there was only one SQL Server build installed.

2: The VS 2010 "auto-installed build" has the term "express" embedded in the name.
Thus, when I saw multiple SQL Server options in various places - I always opted for the one with "express" in the name".

3: The SQL Server 2008 R2 Express build does not have the term "express" embedded in the name that appears in SQL Server Management Studio.
4: The labels on some of the VS drop down boxes don't seem to do what they say they do.
5: It is necessary to know the "secret" word" "localhost" to make it all work.

As I said, what a muddle! (or so it seems to me)
===============================
I suggest that you also use the information in this link to help you to understand what may be going on in your case.
http://sqlsecurity.com/FAQs/SQLServe...3/Default.aspx

Hope this helps.

Ken

Last edited by ken evans; January 4th, 2012 at 01:25 PM.. Reason: correct typo
 
Old January 4th, 2012, 09:12 PM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Thanks Ken,

Yes, what a muddle! I seem to have gotten to the point where things are basically workable - but far from ideal. I can open the planetwrox.mdf in the Server Explorer but not in the App_Data folder - apparently this will not cause any problems going forward in doing the exercises in CH12 and beyond.

I have been able to create a new DB in the App_Data folder - which I could never do before.

I'm not sure what I all did - as you say a lot of fiddling around. I still don't understand all the relationships and dependencies. As it stands, leaving the Tools -> Data Connections Server Instance Name blank is what allowed the new DB to be created in the App_Data folder - prior to this it kept insisting I need to install SQL.

I guess most of my problems occurred because I upgraded VS2005 to VS2010 and apparently SQL 2008 was not installed - it just left SQL 2005. Then I downloaded SQL 2008 R2 before I uninstalled 2005. Perhaps this what got many things fouled up.

Overall, this whole process seems unnecessarily messy and complicated. I've been away from web development for a few years and now want to use VS to create a web site that is more complex than afforded by the simple web creation systems. Imar's book is really excellent - perhaps MS could adopt some of his mindset for explaining how things work.
 
Old January 5th, 2012, 09:52 AM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Hi Imar,

Thanks for your help and I think your book is one of the very best tech books I've read - have followed carefully up to ch 12.

the server name for the mgt studio log-in is just my computer name "DAVEXXXX" and the top line in the studio after it is opened is

DAVEXXXX(SQL Server 10.50.1617 - DAVEXXXX\UUUU) - UUUU being my userid which has administrator privilages.

In the config mgr shows MSSQLSERVER and an ID of MSSQL10_50.MSSQLSERVER

In the tools ->... Data Connections I've tried everything mentioned. Also web.config connectionString.

Oddly, one time, I was able to open your .mdf in VS (in the App_Data folder) by using "add existing item" - but I've not been able to repeat that - the error keeps telling me that I need to install sql server.

I would like to focus on one simple task and hopefully you can help me solve
this: just being able to put a new database in the App_data folder of a fresh new web site.

I create the web site by File | New Web Site | ASP.Net Web Site

Then right click the App-Data folder and select Add New Item | SQL Server Database and then, hopefully, NOT get the darn error that tells me I need sql server. In VS, I just can't get past this error telling me to install and run sql server for this procedure - although I can create a database in the "server explorer" and create tables, etc.


I feel if I can get past this problem then other things should fall in place (hopefully). One thing I'm not sure about is the role of the connection string in the web config file when it comes to doing this. Obviously the reference to SQLEXPRESS is wrong but changing it has not done anything - I've used "data source=DAVEXXXX;" as this is the name mentioned above. It's unclear to me what roles are played by Tools -> data Connections versus the web.config connectionString.

Thanks for your help - I really want to get on with chapter 12!
 
Old January 5th, 2012, 03:42 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Here's what I think happened.

1. You installed SQL Server 2005 Express, which creates a named instance called .\SqlExpress. The . is the machine name and SqlExpress is the instance name

2. You installed SQL Server 2008. This may or may not have been the Express version, but either way it created an unnamed, or default instance to which you can refer using . or the machine's name.

By default, Visual Studio assumes you have an instance called SqlExpress. So, when you double-click an MDF, it tries to connect to .\SqlExpress and attach the database on the fly.

Since you only have a default instance, this is not going to work.

To fix that, either install SQL Server 2008 (R2 if you want) Express and make sure it uses SqlExpress as the instance name.

Alternatively, under Tools | Options | Database Tools | Data Connections, leave the instance name empty, so Visual Studio will try to connect to your default, unnamed instances.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 6th, 2012, 11:42 PM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Thanks Imar,

At this point, I can create a new DB in the App_Data folder by leaving the Tools -> Data Connections blank (just as you suggested). I can open the wrox .mdf in the Server Explorer. I can't open the worx .mdf in App_Data but I'm just going to ignore this and get on with Ch 12.

If I were to redo the installation of VS 2010, I would first uninstall VS 2005, SQL 2005 and anything else remotely related! The upgrade process has turned out to be a royal PITA.

Thanks for your help - again: great book!
 
Old January 7th, 2012, 04:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I can open the wrox .mdf in the Server Explorer. I can't open the worx .mdf in App_Data
Could it be that the MDF in App_Data is already attached to SQL Server through Management Studio? You can't have these two options side by side. Either you use Management Studio, or you use the App_Data folder.....

Quote:
If I were to redo the installation of VS 2010, I would first uninstall VS 2005, SQL 2005 and anything else remotely related!
Yes, that sounds like a smart thing to do. This way, you free up the named instances. I would then use the Web Platform Installer and install SQL Server 2008 R2 Express so you have the latest version.

Quote:
Thanks for your help - again: great book!
Good to hear you like the book. Thanks!

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report & VB6 & SQL Server wlho VB How-To 2 June 5th, 2013 01:58 AM
SQL Server 6.5 & Devices MarioG SQL Server 2000 3 October 6th, 2004 12:47 PM
SQL Server & MSDE reyboy SQL Server 2000 0 September 6th, 2004 10:15 PM
DAO & SQL Server apoorv_gupta Pro VB Databases 0 September 18th, 2003 05:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.