![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Simple question What is the significance of and @ prefix of a string. I see it mostly used in a SQL statement . Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Simple question "@" has no general significance in a string. In SQL statements, some data providers use "@" to indicate a parameter. Using parameters rather than putting the values directly in the SQL statement has several advantages, including automatic data type conversion, prevention of SQL injection attacks and the ability for the backend to calculate the execution plan once for multiple uses of the statement. On Thu, 29 May 2008 11:11:40 -0400, "Phil Hunt" <aaa@xxxxxx> wrote: Quote: >What is the significance of and @ prefix of a string. I see it mostly used >in a SQL statement . > >Thanks > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Simple question I understand what you are saying. But maybe I should give an example right out of a book I am reading. In C# : String strConn = @"Data Source=.\SQLExpress;" + "Initial Catalog=Northwind" The @ sign is not insdei the string. I cannot find any explanation anywhere what this means. TIA "Jack Jackson" <jjackson@xxxxxx> wrote in message news:vo0u34hm92ubmss00bcfvvnk8hvnkuqaov@xxxxxx Quote: > "@" has no general significance in a string. > > In SQL statements, some data providers use "@" to indicate a > parameter. Using parameters rather than putting the values directly > in the SQL statement has several advantages, including automatic data > type conversion, prevention of SQL injection attacks and the ability > for the backend to calculate the execution plan once for multiple uses > of the statement. > > On Thu, 29 May 2008 11:11:40 -0400, "Phil Hunt" <aaa@xxxxxx> wrote: > Quote: >>What is the significance of and @ prefix of a string. I see it mostly used >>in a SQL statement . >> >>Thanks >> |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Simple question Now I think about it. It may something to do with the escaple character \ Right ? "Phil Hunt" <aaa@xxxxxx> wrote in message news:uPbh%23AdwIHA.5620@xxxxxx Quote: >I understand what you are saying. > But maybe I should give an example right out of a book I am reading. > > In C# : > String strConn = @"Data Source=.\SQLExpress;" + > "Initial Catalog=Northwind" > > The @ sign is not insdei the string. I cannot find any explanation > anywhere what this means. > > TIA > > "Jack Jackson" <jjackson@xxxxxx> wrote in message > news:vo0u34hm92ubmss00bcfvvnk8hvnkuqaov@xxxxxx Quote: >> "@" has no general significance in a string. >> >> In SQL statements, some data providers use "@" to indicate a >> parameter. Using parameters rather than putting the values directly >> in the SQL statement has several advantages, including automatic data >> type conversion, prevention of SQL injection attacks and the ability >> for the backend to calculate the execution plan once for multiple uses >> of the statement. >> >> On Thu, 29 May 2008 11:11:40 -0400, "Phil Hunt" <aaa@xxxxxx> wrote: >> Quote: >>>What is the significance of and @ prefix of a string. I see it mostly >>>used >>>in a SQL statement . >>> >>>Thanks >>> > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Simple question Hi Phil, That is because if you dont use @, you have to use \\ to express \ inside a string.. So, if you dont use @, String strConn = "Data Source=.\\SQLExpress;Initial Catalog=Northwind" and if you use @, String strConn = @"Data Source=.\SQLExpress;Initial Catalog=Northwind" Look at MSDN for more information, Jigar Mehta Quote: > I understand what you are saying. > But maybe I should give an example right out of a book I am reading. > In C# : > String strConn = @"Data Source=.\SQLExpress;" + > "Initial Catalog=Northwind" > The @ sign is not insdei the string. I cannot find any explanation > anywhere what this means. > > TIA > > "Jack Jackson" <jjackson@xxxxxx> wrote in message > news:vo0u34hm92ubmss00bcfvvnk8hvnkuqaov@xxxxxx > Quote: >> "@" has no general significance in a string. >> >> In SQL statements, some data providers use "@" to indicate a >> parameter. Using parameters rather than putting the values directly >> in the SQL statement has several advantages, including automatic data >> type conversion, prevention of SQL injection attacks and the ability >> for the backend to calculate the execution plan once for multiple >> uses of the statement. >> >> On Thu, 29 May 2008 11:11:40 -0400, "Phil Hunt" <aaa@xxxxxx> wrote: >> Quote: >>> What is the significance of and @ prefix of a string. I see it >>> mostly used in a SQL statement . >>> >>> Thanks >>> |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Simple question Phil Hunt <aaa@xxxxxx> wrote: Quote: > I understand what you are saying. > But maybe I should give an example right out of a book I am reading. > > In C# : > String strConn = @"Data Source=.\SQLExpress;" + > "Initial Catalog=Northwind" > > The @ sign is not insdei the string. I cannot find any explanation anywhere > what this means. http://pobox.com/~skeet/csharp/strings.html -- Jon Skeet - <skeet@xxxxxx> Web site: http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet C# in Depth: http://csharpindepth.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Simple Question | Vista General | |||
| simple question... really! | Vista General | |||
| Simple Question? | Vista General | |||
| a simple question | Vista General | |||