Skip to content

Instantly share code, notes, and snippets.

@m4tt1mus
Created November 3, 2012 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4tt1mus/4006210 to your computer and use it in GitHub Desktop.
Save m4tt1mus/4006210 to your computer and use it in GitHub Desktop.
Stack Usings
using (SqlConnection conn = new SqlConnection(strConn))
using (SqlCommand cmd = new SqlCommand(strQuery, conn))
using (SqlCommand cmdReset = new SqlCommand("DBCC CHECKIDENT('Doctor', RESEED, 0)", conn))
using (SqlCommand cmdUnCheck = new SqlCommand("alter table [dbo].[Doctor] nocheck constraint all",conn))
using (SqlCommand cmdCheck = new SqlCommand("alter table [dbo].[Doctor] with check check constraint all",conn))
{
// do stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment