when putting multiple sql commands showing error :There is already an open DataReader associated with this Command which must be closed first
You need to change your connection string and add this option
"MultipleActiveResultSets=True;"
Starting from SQL Server 2005 there is MARS option.
With MARS a single opened connection could serve more than one command at a time.
So, for example, your connection string should be like this
"Server=myServerAddress;" +
"Database=myDataBase;" +
"Trusted_Connection=True;" +
"MultipleActiveResultSets=true;"
See the docs on MARS
In a 'normal' configuration, when a SqlDataReader is open, the SqlConnection is busy serving the reader and cannot accept other commands.
(See remarks on the link to SqlDataReader).
Your code above has a reader open when you try to issue a command using the same connection.
There are workarounds like filling a DataSet and then looping over it (but for large sets this will impact performances), so the SQL Team at Microsoft introduced MARS