Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / February 2005

Tip: Looking for answers? Try searching our database.

Problem with Datareader.close

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andy - 01 Feb 2005 07:17 GMT
Hi,

I have an asp.net application and am facing a problem while closing my
datareader object. I am using Active reports for dotnet for generating
reports.

I create a datareader object in my data access layer and then pass it
to the calling function ( I know this isnt a good practice, but I cant
change this). I am using the commandbehaviour.closeconnection property
while opening the datareader. The problem occurs when the
Datareader.close() function is called, the page just hangs there and
nothing happens!. I am unable to understand why this happens. I
checked the connection state when I'm calling close , it shows that
the connection state is Open.

The code works fine on one of my development machines but hangs on two
other machines. I'm attaching the code where I'm getting a problem.
Please let me know if you can see any errors or why I'm facing this
problem.

private void rpt_Report1_ReportStart(object sender, System.EventArgs
{
try
 {
     ReportHelper rh=new ReportHelper();               
      //SQL Query
     StringBuilder sbSQL=new StringBuilder();
     sbSQL.Append("SELECT * from tablename");
    mReader=SqlHelper.ExecuteReader(mConnString,CommandType.Text,sbSQL.ToString());
    sbSQL=null;
    rh=null;
  }       
}

private void rpt_Report1_ReportEnd(object sender, System.EventArgs
eArgs)
{   
  mReader.Close();
  mReader=null;   
}

Thanks in advance

Andy
Cowboy (Gregory A. Beamer) - MVP - 01 Feb 2005 18:33 GMT
Consider creating the connection, command and dataReader and then passing in
the command and datareader to your DAL. It may hang as it is trying to find
and clsoe the underlying connection.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> Hi,
>
[quoted text clipped - 40 lines]
>
> Andy

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.