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

Benefits of microservices

Benefits of microservices      1. Development & Team Agility Architecture- and language-neutral: Teams aren't locked into one progr...