Re: SqlDataReader do I need to call close?
- From: vik <vik@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 9 Aug 2008 16:03:00 -0700
sorry, but i need to be sure, lets say i use this snippet:
Connection.Open();
dr=cmd.ExecuteReader();
if(dr.Read())
str=dr[0].ToString();
Connection.Close();
/// end of page rpocessing in ASP.Net
will it be working ok? connection closed, datareader will dispose as going
out of scope? i'm not asking about best practice now but about do i need to
review bulk of code and projects to add dr.Close() everywhere or I can leave
it as is, as far as it seem to work and connections are closed without
calling dr.close()? or may be there is still some resource leak or somthing?
thank you.
.
- Follow-Ups:
- Re: SqlDataReader do I need to call close?
- From: Cor Ligthert[MVP]
- Re: SqlDataReader do I need to call close?
- From: William Vaughn \(MVP\)
- Re: SqlDataReader do I need to call close?
- References:
- Prev by Date: Re: SQL Express Edition Network Deployment Error
- Next by Date: Re: SqlDataReader do I need to call close?
- Previous by thread: RE: SqlDataReader do I need to call close?
- Next by thread: Re: SqlDataReader do I need to call close?
- Index(es):