Trusted connection in .NET framework

In this article I will explain about alternative syntax used for trusted connection in .NET Framework.
  • 1739

Introduction

Here I am explaining how to create alternative syntax for trusted connection in .NET framework. It is based on windows authentication.

Alternative Syntax for Trusted Connection

There are another way to create standard security SQL Server connection string we put data source, initial catalog, user id and password. This connection String also provide same result as result provided by above connection string.

Syntax

 Server=urServerAddress;Database=urDataBase;Trusted_Connection=True;

Example

SqlConnection scon = new SqlConnection("Server=.;Initial Database=db;Trusted_Connection=True");
SqlCommand scom = new SqlCommand("SELECT * FROM [dbo].[mcnemp]", scon);

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.