How to Create Standard Security in .NET Framework

In this article I am going to explain about what is standard security in .NET Framework.
  • 2144

Introduction

Here I am explaining how to create standard security in
.NET Framework . There are two way to create standard security. It is based on SQL server authentication.

Standard Security

For creating standard security SQL server connection string we put data source, initial catalog, user id and password.

Syntax

 Data Source=urServerAddress;Initial Catalog=urDataBase;User Id=urUsername;Password=urPassword;





Example

 SqlConnection scon = new SqlConnection("Data Source=.;Initial Catalog=db;User ID=sa;Password=wintellect");
SqlCommand scom = new SqlCommand("SELECT * FROM [dbo].[mcnemp]", scon);

Alternative Syntax for Standard Security

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;UserID=urUsername;Password=urPassword;Trusted_Connection=False;

Example

SqlConnection scon = new SqlConnection("Server=.;Initial Database=db;User ID=sa;Password=wintellect;Trusted_Connection=False");
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

© 2019 DotNetHeaven. All rights reserved.