[{"data":1,"prerenderedAt":341},["ShallowReactive",2],{"article-string-literals-and-c":3},{"article":4,"tags":97,"previous":111,"next":197},{"id":5,"title":6,"author":7,"body":8,"createdAt":85,"description":86,"extension":87,"img":88,"meta":89,"navigation":90,"path":91,"seo":92,"stem":93,"tags":94,"updatedAt":85,"__hash__":96},"articles\u002Farticles\u002Fstring-literals-and-c.md","String Literals and C#","[object Object]",{"type":9,"value":10,"toc":81},"minimark",[11,15,38,48,69,72],[12,13,14],"p",{},"I was looking for some utility that would take a very long string and convert it to vb.net or c# with line continuation(s) characters. String literals to the rescue.  C# supports two forms of string literals: regular string literals and verbatim string literals. ",[12,16,17,18,25,26,33,34,37],{},"A ",[19,20,21],"strong",{},[22,23,24],"u",{},"regular string literal"," consists of zero or more characters enclosed in double quotes, as in ",[27,28,29,30,29],"code",{},"\"",[27,31,32],{},"hello",", and may include both simple escape sequences (such as ",[27,35,36],{},"\\t"," for the tab character) and hexadecimal and Unicode escape sequences. ",[12,39,40,41,44,45,47],{},"In c# regular strings can only span multiple lines with syntax similar to the following: string sql = “SELECT customer “ +",[42,43],"br",{},"\n“FROM customers “ +",[42,46],{},"\n“WHERE custId=10”;",[12,49,17,50,55,56,59,60,63,64,68],{},[19,51,52],{},[22,53,54],{},"verbatim string literal"," consists of an ",[27,57,58],{},"@"," character followed by a double-quote character, zero or more characters, and a closing double-quote character. A simple example is ",[27,61,62],{},"@\"hello\"",". In a verbatim string literal, the characters between the delimiters are interpreted verbatim, the only exception being a ",[65,66,67],"i",{},"quote-escape-sequence",".",[12,70,71],{},"In particular, simple escape sequences and hexadecimal and Unicode escape sequences are not processed in verbatim string literals.  The above sample can be replaced with the ‘literal’ designated by the @ symbol as follows:",[12,73,74,75,77,78,80],{},"string sql = @“SELECT",[42,76],{},"\nFROM customers",[42,79],{},"\nWHERE custId=10”;",{"title":82,"searchDepth":83,"depth":83,"links":84},"",2,[],"2015-04-20T08:07:18.0100000-04:00",null,"md","\u002Farticles\u002Fimages\u002FF0VD2LVE2v.png",{},true,"\u002Farticles\u002Fstring-literals-and-c",{"title":6,"description":86},"articles\u002Fstring-literals-and-c",[95],"csharp","wR7AFv2jyIEaMk54IdB_kd0WIeTKqKzKljWKic55QNQ",[98],{"id":99,"title":100,"body":101,"description":86,"extension":87,"img":105,"meta":106,"name":95,"navigation":90,"path":107,"seo":108,"stem":109,"__hash__":110},"tags\u002Ftags\u002Fcsharp.md","Csharp",{"type":9,"value":102,"toc":103},[],{"title":82,"searchDepth":83,"depth":83,"links":104},[],"https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fcsharp",{"description":86},"tags\u002Fcsharp","q__D01bgRc46igktetL1XSIb0CS3jpaQOtnTfdNZJyQ",{"id":112,"title":113,"author":7,"body":114,"createdAt":188,"description":189,"extension":87,"img":86,"meta":190,"navigation":90,"path":191,"seo":192,"stem":193,"tags":194,"updatedAt":188,"__hash__":196},"articles\u002Farticles\u002Fsql-execution-enterprise-manager-qa-vs-net-execution.md","SQL Execution (Enterprise Manager-QA) VS. .NET Execution",{"type":9,"value":115,"toc":186},[116,138,160],[12,117,118,119,121,122,124,125,127,128,130,131,133,134,137],{},"I have been chasing an issue for quite a while where the query would timeout when executed from an ASP.NET interface.  If I ran that exact same query through Query Analyzer the results would be returned in less than 2 seconds.    I have for a while been struggling with why it is different between those two interfaces.  I thought about connection pooling issues, command time outs and connection timeouts and was focused on that for a while.  Even after extending those values from the default the query would still time out.  It was often I would see an exception similar to   ---------------------------  SQL Exception Information:",[42,120],{},"\nErrorId: -2",[42,123],{},"\nMessage: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.",[42,126],{},"\nLine Number: 0",[42,129],{},"\nProcedure:",[42,132],{},"\n---------------------------  To put this post in the proper context think about one of your application search stored procedures.  The interface shows a dozen or more optional textboxes for user entry to narrow down the results.  The stored procedure in this case often has many parameters that could be used with the actual query.  This is the case for the query that I am discussing herein.  When you execute a stored procedure for the first time the query processor constructs a query plan based on the the state of the statistics and the input parameters.  So, the query plan is created upon first execution and is cached in case some other invocation of the same stored procedure comes along before the cache is cleared.  So, when executing through the web interface SQL Server is using the same execution plan that was created by the prior user.  This can look significantly different between users and what parameters they provide before they run the search.  So, to have SQL Server generate a new query plan upon each execution the \"",[19,135,136],{},"WITH RECOMPILE","\" can be used.  By adding this parameter SQL Server regardless of the parameters passed in it will create a new optimal plan.  ",[139,140,141,142,144,145,147,148,150,151,153,154,156,157],"blockquote",{},"   i.e.",[42,143],{},"\nCreate Procedure dbo.GetCustomers",[42,146],{},"\n            @LastName varchar(200),",[42,149],{},"\n            @FirstName varchar(200),",[42,152],{},"\n            .... \nWITH RECOMPILE AS",[42,155],{},"\n  BEGIN",[12,158,159],{},"  END ",[139,161,162,163,144,165,147,167,150,169,171,172,156,174,176,177,179,180,182,183,185],{},"   i.e. SQL 2005 option",[42,164],{},[42,166],{},[42,168],{},[42,170],{},"\n            .... \nAS",[42,173],{},[42,175],{},"\n      Query 1",[42,178],{},"\n      Query 2 OPTION(RECOMPILE)",[42,181],{},"\n      Query 3 OPTION(RECOMPILE)",[42,184],{},"\n      Query 4 \n  END ",{"title":82,"searchDepth":83,"depth":83,"links":187},[],"2015-04-20T08:07:18.1100000-04:00","I have been chasing an issue for quite a while where the query would timeout when executed from an ASP.NET interface.  If I ran that exact same query through Query Analyzer the results would be returned in less than 2 seconds.    I have for a while been struggling with why it is different between those two interfaces.  I thought about connection pooling issues, command time outs and connection timeouts and was focused on that for a while.  Even after extending those values from the default the query would still time out.  It was often I would see an exception similar to   ---------------------------  SQL Exception Information:\nErrorId: -2\nMessage: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.\nLine Number: 0\nProcedure:\n---------------------------  To put this post in the proper context think about one of your application search stored procedures.  The interface shows a dozen or more optional textboxes for user entry to narrow down the results.  The stored procedure in this case often has many parameters that could be used with the actual query.  This is the case for the query that I am discussing herein.  When you execute a stored procedure for the first time the query processor constructs a query plan based on the the state of the statistics and the input parameters.  So, the query plan is created upon first execution and is cached in case some other invocation of the same stored procedure comes along before the cache is cleared.  So, when executing through the web interface SQL Server is using the same execution plan that was created by the prior user.  This can look significantly different between users and what parameters they provide before they run the search.  So, to have SQL Server generate a new query plan upon each execution the \"WITH RECOMPILE\" can be used.  By adding this parameter SQL Server regardless of the parameters passed in it will create a new optimal plan.  ",{},"\u002Farticles\u002Fsql-execution-enterprise-manager-qa-vs-net-execution",{"title":113,"description":189},"articles\u002Fsql-execution-enterprise-manager-qa-vs-net-execution",[195],"sqlserver","B2ug2YjmetZNfsPVc-Gc3dmawycSNaf-YqYAdz1IpqQ",{"id":198,"title":199,"author":7,"body":200,"createdAt":333,"description":86,"extension":87,"img":86,"meta":334,"navigation":90,"path":335,"seo":336,"stem":337,"tags":338,"updatedAt":333,"__hash__":340},"articles\u002Farticles\u002Ftesting-web-serviceasmx-remotely-yes-you-can.md","Testing Web Service(ASMX) Remotely (yes, you can!)",{"type":9,"value":201,"toc":331},[202,205],[12,203,204],{},"Often we test web services by either locally on our workstations or remoting to the server and accessing the asmx page. ",[12,206,207,208,326,327],{},"If you try to access the asmx remotely however you are not given the option to test the server (by using the server url address).  By adding the following code the \u003Csystem.web> section of asmx web site web.config you can now test your services remotely.  ",[209,210,214,227,244,259,273,287,305,319],"span",{"className":211,"style":213},[212],"Apple-style-span","word-spacing: 0px; font: 12px\u002F15px verdana; text-transform: none; color: rgb(51,51,51); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; text-align: left; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0",[215,216,217],"em",{},[218,219,221],"font",{"size":220},3,[218,222,224,225],{"face":223},"Calibri","\u003CwebServices>",[42,226],{},[215,228,229],{},[218,230,231],{"size":220},[218,232,233,241,242],{"face":223},[209,234,235,236],{},"       ",[209,237,240],{"className":238},[239],"Apple-converted-space"," ","\u003Cprotocols>",[42,243],{},[215,245,246],{},[218,247,248],{"size":220},[218,249,250,256,257],{"face":223},[209,251,252,253],{},"           ",[209,254,240],{"className":255},[239],"\u003Cadd name=\"HttpSoap12\"\u002F>",[42,258],{},[215,260,261],{},[218,262,263],{"size":220},[218,264,265,270,271],{"face":223},[209,266,252,267],{},[209,268,240],{"className":269},[239],"\u003Cadd name=\"HttpSoap\"\u002F>",[42,272],{},[215,274,275],{},[218,276,277],{"size":220},[218,278,279,284,285],{"face":223},[209,280,252,281],{},[209,282,240],{"className":283},[239],"\u003Cadd name=\"HttpGet\"\u002F>",[42,286],{},[215,288,289],{},[218,290,291],{"size":220},[218,292,293,299,302,303],{"face":223},[209,294,295,296],{},"         ",[209,297,240],{"className":298},[239],[209,300,301],{},"  ","\u003Cadd name=\"HttpPost\"\u002F>",[42,304],{},[215,306,307],{},[218,308,309],{"size":220},[218,310,311,316,317],{"face":223},[209,312,235,313],{},[209,314,240],{"className":315},[239],"\u003C\u002Fprotocols>",[42,318],{},[215,320,321],{},[218,322,323],{"size":220},[218,324,325],{"face":223},"\u003C\u002FwebServices>","  ",[209,328,330],{"className":329,"style":213},[212],"The above code addresses the issue related to \"The test form is only available for requests from the local machine.\" error message.",{"title":82,"searchDepth":83,"depth":83,"links":332},[],"2015-04-20T08:07:17.9200000-04:00",{},"\u002Farticles\u002Ftesting-web-serviceasmx-remotely-yes-you-can",{"title":199,"description":86},"articles\u002Ftesting-web-serviceasmx-remotely-yes-you-can",[339],"aspnet","SxKDc8JlqMksiHb_H-HoXeE2EcSX8ZxEqtt1Yn_DRPQ",1781574763376]