May 8, 2018 at 12:01 am
Comments posted to this topic are about the item SQL Server From .Net: Connecting Visual Studio Community Edition to SQ
May 8, 2018 at 11:53 am
instead of: conn.ConnectionString = "Data Source=.\\sqlexpress;Initial Catalog=tempdb;Integrated Security=True";
this is an option: conn.ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=tempdb;Integrated Security=True";
or even:conn.ConnectionString = new SqlConnectionStringBuilder
{DataSource = @".\sqlexpress", InitialCatalog = "tempdb", IntegratedSecurity = true}.ToString();
I'm using the builder more these days since you get compiler help and can't misspell keywords (though you still can mess up the arguments of course).
May 8, 2018 at 6:42 pm
gbritton1 - Tuesday, May 8, 2018 11:53 AMinstead of:conn.ConnectionString = "Data Source=.\\sqlexpress;Initial Catalog=tempdb;Integrated Security=True";
this is an option:
conn.ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=tempdb;Integrated Security=True";
or even:
conn.ConnectionString = new SqlConnectionStringBuilder
{DataSource = @".\sqlexpress", InitialCatalog = "tempdb", IntegratedSecurity = true}.ToString();I'm using the builder more these days since you get compiler help and can't misspell keywords (though you still can mess up the arguments of course).
Yes, thanks for mentioning those options.
I first learned about the string builder when I was doing the research for the article on the connection string in this "occasional series" of articles.
Maybe I should have said something like "... and any other way you can put a string together..."
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply