SqlConnection con = new SqlConnection("Data Source=localhost;Integrated Security=True;Initial Catalog=Pubs");
SqlCommand cmd = new SqlCommand("INSERT Titles (Title) VALUES ('Some Title')", con);
try
{
con.Open();
cmd.ExecuteNonQuery();
}
finally
{
con.Close();
}