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

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...