Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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 February 10th, 2014, 01:11 AM
Authorized User
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default Ch 19 SQL connection string

Hi Imar,

My first step toward publishing was to add IIS to a VM running Server 2012. I was successful (to a degree - there are still some permissions problems). I won't be able to load to a hosting service until I have a new site designed. But in the meantime I'd like to make sure I understand the database connections.

The text instructs to change the connection string for SQL, but I didn't change anything and the site worked fine. I also checked the Final folder of the downloaded code and noticed those connection strings were not changed.

Could you provide a little insight to explain why the connection string didn't need to be changed so I'm prepared later to know when I do need to change it.

Thanks.

Best Regards,
Alan
 
Old February 10th, 2014, 05:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you post your connection string? Local DB should not be supported under IIS so that shouldn't work out of the box. Maybe you used SqlExpress instead?

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 February 11th, 2014, 12:11 PM
Authorized User
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default

Hi Imar,

Here's the strings from web.config that I used (and never changed):

Code:
  <connectionStrings>
    <add name="PlanetWroxConnectionString1"
                     connectionString="Data Source=(LocalDB)\v11.0;
                     AttachDbFilename=|DataDirectory|\PlanetWrox.mdf;
                     Integrated Security=True"
                     providerName="System.Data.SqlClient" />

    <add name="PlanetWroxEntities"
                     connectionString=
                       "metadata=res://*/App_Code.PlanetWrox.csdl|
                       res://*/App_Code.PlanetWrox.ssdl|
                       res://*/App_Code.PlanetWrox.msl;
                       &#xA;
                       provider=System.Data.SqlClient;
                       provider connection string=&quot;
                       data source=(LocalDB)\v11.0;
                       &#xA;
                       attachdbfilename=|DataDirectory|\PlanetWrox.mdf;
                       integrated security=True;
                       &#xA;
                       MultipleActiveResultSets=True;
                       App=EntityFramework&quot;"
                     providerName="System.Data.EntityClient" />
  </connectionStrings>
So you raise an interesting point. 'Maybe you used SqlExpress instead'. I think you might be right, but I don't know how to tell which is installed. Where do you determine the type of SQL? Most places I looked in the application just said SQL, I didn't see a reference to 'Express'.

BTW, can you explain what the short terms "&#xA" are in the 2nd connection string? I didn't see them in your sample code, but Visual Studio seemed to have put them in the strings.

Best Regards,
Alan
 
Old February 11th, 2014, 12:34 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Your connection strings refer to LocalDB so that's what's being used (for Express you would have seen .\SqlExpress). Check out Appendix B for more information.

LocalDB shouldn't be supported under IIS, so maybe your system has something configured to make it work, as explained in this post: http://blogs.msdn.com/b/sqlexpress/a...r-profile.aspx

Regarding &#xA, Google says it's a line feed: http://stackoverflow.com/questions/5...e-xa-character. It shouldn't be there so you can safely remove it.

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!
The Following User Says Thank You to Imar For This Useful Post:
AlanWheeler (February 11th, 2014)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String Ch 16 DavidN BOOK: Beginning Microsoft Visual Basic 2010 6 November 4th, 2011 04:41 AM
SQL connection string naeem.net SQL Server ASP 0 July 10th, 2007 02:17 PM
SQL Express installation; Page 931; Ch 19 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 1 July 31st, 2006 12:13 AM
SQL Server Connection String Nicky2k Classic ASP Basics 4 January 13th, 2005 05:22 AM





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