Opening and Closing Connections
Case in point: managing of sql database connection resources. How many of us learned to write something like this:
Sure it’s easy to follow, but if you deploy that on a moderately busy server you are going to make your client very unhappy.
Insert Data into Database-
Case in point: managing of sql database connection resources. How many of us learned to write something like this:
// Create a new SQL Connection object
SqlConnection conn = new SqlConnection( connectionString );
// Open the connection to the database
conn.Open();
// Create a new SQL Command
SqlCommand cmd = new SqlCommand( “DELETE FROM BabyNames;”, conn );
// Execute the command
cmd.ExecuteNonQuery();
// Close the database connection
conn.Close();
Sure it’s easy to follow, but if you deploy that on a moderately busy server you are going to make your client very unhappy.
Insert Data into Database-
No comments:
Post a Comment