Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
|
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 September 10th, 2013, 02:06 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default What's wrong with the following connection string

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Here is the following error message
Code:
Compiler Error Message: CS1009: Unrecognized escape sequence

Source Error:


Line 9:      //  Create a new connection object
Line 10:     SqlConnection conn = new SqlConnection(
Line 11:         "Server=OWNER-PC\MSSQLSERVER1;Database=HalloweenCandyStore;" +
Line 12:         "Integrated Security=True");
Line 13:     // Create a new command object
Here is the actual code that is trying to be used in the webpage:
Code:
 <%@ Page Language="C#" %>
<%@ Import Namespace = "System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Page_Load(object sender, EventArgs e)
  {
    //  Create a new connection object
    SqlConnection conn = new SqlConnection(
        "Server=OWNER-PC\MSSQLSERVER1;Database=HalloweenCandyStore;" +
        "Integrated Security=True");
    // Create a new command object
    SqlCommand comm = new SqlCommand(
      "SELECT EmployeeID, Name FROM Employees", conn);
    // Open connection
    conn.Open();
    // Execute the command
    SqlDataReader reader = comm.ExecuteReader();
    // Read and display the data
    while (reader.Read())
    {
      employeesLabel.Text += reader["Name"] + "<br />";
    }
    // Close the reader and the connection
    reader.Close();
    conn.Close();
  }
</script>
 
Old September 10th, 2013, 02:19 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 please, please, post this in the proper forum? This is not related to my book at all, so it doesn't make sense to post it here. Try posting this in the general ASP.NET forum and I'll take a look. Gets boring after a while, repeating this same request over and over again.

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 September 10th, 2013, 02:27 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Okay

I thought that connection strings issues were part of the book. I have a hard time understanding the criteria that you are using for what content should be published here and what to publish some place else.
 
Old September 10th, 2013, 02: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

I explained this before, but I am happy to do it again. If it is directly from the book: a piece of text, an exercise or a topic that is explained in detail then it's about the book. Otherwise it's not.

Your question uses a SqlConnection (not discussed) and a connection string in C# code (also not discussed) so this has nothing to do with my book.

Why don't you stay on the safe side and always post in the general forum?

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
String Bug / Crazy Error / Compiler Wrong pacala_ba C++ Programming 1 May 3rd, 2009 11:12 PM
Connection string bex BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 August 3rd, 2008 02:16 PM
connection string Sheraz Khan ASP.NET 2.0 Basics 3 July 5th, 2007 08:33 AM
what is wrong with this access connection? method Access VBA 1 April 27th, 2005 01:38 PM
Connection string tlamazares SQL Server ASP 1 March 29th, 2004 05:16 PM





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