Skip to content

Instantly share code, notes, and snippets.

@smetronic
Created November 15, 2016 11:01
Show Gist options
  • Save smetronic/45880e4949c92dc55ec317c4305a516a to your computer and use it in GitHub Desktop.
Save smetronic/45880e4949c92dc55ec317c4305a516a to your computer and use it in GitHub Desktop.
ExecuteNonQuery
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString))
{
connection.Open();
using (SqlCommand cmd = new SqlCommand(@"SELECT * FROM Table WHERE Id = @Input", connection))
{
cmd.Parameters.Add("Input", SqlDbType.Int).Value = 1;
cmd.ExecuteNonQuery();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment