Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > ASP.NET 4.5 General Discussion
|
ASP.NET 4.5 General Discussion For ASP.NET 4.5 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5 General Discussion 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:29 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Connection strings posted in general as you requested

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:
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, 03:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you Google for the exact error message? That should bring up some useful suggestions....

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, 03:37 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Okay I didn't see it.

I am sorry I overlooked the error message in the yellow screen of death that I got. I missed it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection strings arun_babu_a BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 1st, 2011 12:52 PM
CH30 Connection Strings morphius BOOK: Professional C# 4.0 and .NET 4 0 November 23rd, 2010 01:23 PM
Connection Strings WFletch Visual Basic 2008 Essentials 1 July 14th, 2008 09:42 AM
Connection Strings WillyWonker BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 January 25th, 2005 10:40 AM
Connection Strings hcweb Classic ASP Basics 6 September 23rd, 2004 03:29 AM





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