Answer:
We can use pass it with ExecuteReader method of Command object like
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
This will make sure that when we are calling reader.Close() the associated connection object will also be closed.
Asked In: Many Interviews |
Alert Moderator