Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:48:06+00:00 2026-06-14T19:48:06+00:00

I am writing a c# application. I connect to a backend SQL Server for

  • 0

I am writing a c# application. I connect to a backend SQL Server for some processing. However I hit into a weird issue today. This is my code:

static void Main(string[] args)
{
    SqlConnection con = new SqlConnection("Integrated Security=true");
    con.Open();

    SqlCommand cmd = new SqlCommand("SELECT SERVERPROPERTY('ProductVersion')", con);
    cmd.CommandType = CommandType.Text;

    SqlDataReader reader = cmd.ExecuteReader();
    reader.Read();

    Console.WriteLine(reader.GetString(0));
    Console.Read();
}

I haven’t given the server name in the Connection String, but still it connects to my local database and retrieves the required data. I am wondering how. Is the default data source set to local machine? Does “Integrated Security=true” have something to do with this?

Can someone explain this?

Thanks,
Sornakumar S

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:48:07+00:00Added an answer on June 14, 2026 at 7:48 pm

    Looking at the docs on ConnectionString on MSDN you could find this information

    To connect to a local computer, specify “(local)” for the server. If a
    server name is not specified, a connection will be attempted to the
    default instance on the local computer.

    http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.100).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an application which can connect to any SQL Server Database, thus
I'm writing a simple application which will connect with a server. However I want
I am writing an application which uses web services to connect a remote server.I
I'm writing an application that needs to connect to the Team Foundation Server, and
I am currently writing an C# asp.net application to connect to an IIS server
I'm writing an application which has to be configurable to connect to Oracle, SQL
I am writing an app to connect to a third party application using REST
I'm writing a vb.net application which connects to a db using integrated security. However,
I am writing application in Linux using C, pthreads and sockets. This will be
VS 2005 WinXP I am writing an application that will connect to a samba

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.