27 October 2011

Basic Connectivity C# with Sql Server

Basic Connectivity C# with Sql Server 
 
private static void CreateConnection(string queryString,string connectionString)
{
    using (SqlConnection connection = new SqlConnection(
               connectionString))
    {
        SqlCommand command = new SqlCommand(queryString, connection);
        command.Connection.Open();
        command.ExecuteNonQuery();
    }
}
 
sample connection string for C#
"Persist Security Info=False;Integrated Security=true;Initial Catalog=Northwind;
server=(local)"

No comments:

Post a Comment

Comments Welcome

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...