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,
(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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)