Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 March 8th, 2007, 02:58 AM
Authorized User
 
Join Date: Feb 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default The BeerHouse 'Connection String Error'

The Error appeared 'R-0699539F8F\SQLExpress' stating that "unrecognized escape sequence"
Why this error is there while it is working in vb.net???

SqlConnection con = new SqlConnection();
                con.ConnectionString = "Server=R-0699539F8F\SQLExpress;Initial Catalog=TheBeerHouse;Integrated Security=true";
                SqlDataAdapter da2 = new SqlDataAdapter((" select OrderID, AddedBy, AddedDate, ShippingMethod, ShippedDate, Subtotal, Shipping, ShippingFirstName, ShippingLastName, ShippingStreet, ShippingPostalCode, ShippingCity, ShippingState, ShippingCountry, CustomerEmail, CustomerPhone, CustomerFax from tbh_Orders where OrderID = (select Max(OrderID) from tbh_Orders)"), con);
                SqlDataAdapter da = new SqlDataAdapter((" Select OrderID, OrderItemID, Title, TitleA, SKU, UnitPrice, Quantity from tbh_OrderItems where OrderID = (select Max(OrderID) from tbh_OrderItems)"), con);
                DataSet myds = new DataSet();
                da2.Fill(myds, "Orders");
                da.Fill(myds, "OrderItems");
                DataRelation rel = myds.Relations.Add("MyRelation", myds.Tables[0].Columns["OrderID"], myds.Tables[1].Columns["OrderID"]);
                rel.Nested = true;
                myds.WriteXml("c:\\NestedXml.xml", XmlWriteMode.IgnoreSchema);


 
Old March 21st, 2007, 01:28 AM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

u forgot the following statement after the SqlConnection con...... statement

con.Open()






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error msg: Invalid connection string attribute cJeffreywang ASP.NET 2.0 Basics 3 April 28th, 2008 11:40 AM
Connection String error in ASP picky Classic ASP Databases 1 October 19th, 2007 07:37 AM
Connection string MunishBhatia ASP.NET 2.0 Professional 4 May 16th, 2007 05:50 AM
Connection String phungleon Dreamweaver (all versions) 1 February 11th, 2004 05:14 AM
Connection String Help. diamond2165 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2003 06:09 AM





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