Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
| Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2005, 09:22 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid attempt to FieldCount when reader is close

I am using VS 2005 and created crystal report file abc.rpt and when I choose preview it shows the content correctly (The report was created using calling stored procedure which had 2 params). When I inserted this abc.rpt to one of my asp.net form, I get the following error message after through with Page_Load().

Stack Trace:


[InvalidOperationException: Invalid attempt to FieldCount when reader is closed.]
   System.Data.SqlClient.SqlDataReader.get_FieldCount () +62
   System.Data.Common.DbEnumerator.BuildSchemaInfo() +76
   System.Data.Common.DbEnumerator.MoveNext() +35
   System.Web.UI.WebControls.ListControl.PerformDataB inding(IEnumerable dataSource) +688
   System.Web.UI.WebControls.ListControl.OnDataBindin g(EventArgs e) +81
   System.Web.UI.WebControls.ListControl.PerformSelec t() +32
   System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +99
   CrystalDecisions.Web.CrystalReportSource.GetContro lParameterValue(ControlParameter parameter) +332
   CrystalDecisions.Web.CrystalReportSource.GetParame terValue(Parameter parameter) +140
   CrystalDecisions.Web.CrystalReportSource.BindContr olParameter(Parameter parameter) +513
   CrystalDecisions.Web.CrystalReportSource.DataBindP arameters() +191
   CrystalDecisions.Web.CrystalReportSource.EnsurePar ameters(Boolean forceDataBind) +90
   CrystalDecisions.Web.CrystalReportSource.LoadCompl eteEventHandler(Object sender, EventArgs e) +47
   System.Web.UI.Page.OnLoadComplete(EventArgs e) +96
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4085

Can anybody tell me how to fix this problem?
Thank you.


 
Old December 28th, 2005, 01:18 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem was solved when I set the parameters from the code instead from the UI's property for Parameters. In another word, instead of using Parameter Colelction Editor fomr MS VS 2005, I entered the following lines instead;
crDailySource.ReportDocument.SetParameterValue("@m ilestones", ddlMilestones.SelectedItem.Text);
crDailySource.ReportDocument.SetParameterValue("@r elease", ddlRelease.SelectedItem.Text);
Now, it's working like charm :D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
user function attempt demac43 Excel VBA 3 November 8th, 2006 05:59 PM
Invalid attempt to Read when reader is closed. nidy_online VS.NET 2002/2003 0 April 28th, 2004 11:02 AM
Invalid attempt to Read when reader is closed. nidy_online VS.NET 2002/2003 1 April 28th, 2004 02:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.