Results 1 to 3 of 3

Thread: query about connection string in c#.net

  1. #1
    Join Date
    Nov 2006

    query about connection string in c#.net

    This is the code from C# in .net

    1. how are the below 2 codes different :-

    i) string connectionString ="data source=myserver;user id=myusername;password=mypassword;";

    ii) string connectionString = @"server = myserver;uid = myusername;password = mypassword;";

    2. and plz explain me the meaning of "@" in the ii) part.

    thanks and regards,

  2. #2
    Join Date
    Apr 2005
    (i) is regular string literal; it consists of zero or more characters enclosed in double quotes (i.e: "yo!")

    (ii) is a verbatim string literal; it consists of an @ character followed by a double-quote character, zero or more characters, and a closing double-quote character (i.e: @"yo!")

    the "yo" was a bad example, but consider you want to print a double quote in your string like this: yo"

    you can't do it with regular string literal because the double quote will treat as "closing double-quote".

    in order to print: yo", you need to:


    detail is here
    "Java is great, PHP sucks and .NET can't scale" - Shaun Connoly, JBoss's vice president of product development. April 5, 2006

  3. #3
    Join Date
    Nov 2006

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center