Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: CRAXDDRT 11.0 Post Reply Post New Topic
Author Message
winseelan
Newbie
Newbie
Avatar

Joined: 18 Aug 2008
Location: India
Online Status: Offline
Posts: 3
Quote winseelan Replybullet Topic: CRAXDDRT 11.0
    Posted: 18 Aug 2008 at 9:56pm

Hi to all,

           Am using Asp.Net 2.0 VS.2005 and Crystal report product version 11.0.0.1282. During run time i want to design the field settings in crystal report detail section. Because my SP return 5 / 8 / 20 column depending upon the situation so no need to design the fields at design time , i like to design the fields at runtime so i select Crystal Reports ActiveX Designer Design and Runtime Library 11.0 from COM, with this dll i write the folowing simple code.

private void CrystalReportDynamicDataBind()                    CRAXDDRT.ApplicationClass CrAppl = new CRAXDDRT.ApplicationClass();            CRAXDDRT.Report CrReport;           

CRAXDDRT.Section crSection;           

CRAXDDRT.Section crHeaderSection;           
CRAXDDRT.Section aa;           

CRAXDDRT.Section bb;           

CRAXDDRT.Section cc;           

SqlConnection cnn;           

SqlDataAdapter da;           

DataSet ds;           

try            

{               

CrReport = CrAppl.NewReport();                               

aa = CrReport.Sections[1];              

 crSection = CrReport.Sections[2];              

 crHeaderSection = CrReport.Sections[3];        

      bb = CrReport.Sections[4];               

cc = CrReport.Sections[5];               

CrReport.PaperSize = CRAXDDRT.CRPaperSize.crPaperA3;                CrReport.PaperOrientation = CRAXDDRT.CRPaperOrientation.crLandscape;                CrReport.PaperSource = CRAXDDRT.CRPaperSource.crPRBinLargeCapacity;                                                 string connectionString = ConfigurationManager.ConnectionStrings["JJConnectionString1"].ToString().Trim();               

cnn = new SqlConnection(connectionString);              

 string sqlString = "Select id   From   Table_1";               

da = new SqlDataAdapter(sqlString, cnn);               

ds = new DataSet();               

da.Fill(ds, "Table_1");                CrReport.Sections[2].AddTextObject("id", 4000, 200, null);  

               CrReport.Sections[3].AddFieldObject("{id}", 4000, 1000);

crSection.AddLineObject(0, 0, 1000, 2000, CrReport.Sections[2]);                 crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTDataDate, 0, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTDataTime, 1500, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTFileCreationDate, 3000, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTFilename, 4000, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTGroupNumber, 5000, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTModificationDate, 6000, 0);                crSection.AddSpecialVarFieldObject(CRAXDDRT.CRSpecialVarType.crSVTPageNumber, 7000, 0);                  CrReport.SaveAs(Server.MapPath("CrystalReport1.rpt"), CRAXDDRT.CRReportFileFormat.cr70FileFormat);                 CrystalReportViewer1.DisplayToolbar = true;                ReportDocument reportDocument1 = new ReportDocument();                reportDocument1.Load(Server.MapPath("CrystalReport1.rpt"));                  reportDocument1.SetDatabaseLogon("", "", ".", "JJ");                reportDocument1.SetDataSource(ds);                CrystalReportViewer1.ReportSource = reportDocument1;

}          

 catch (Exception ex)           

{               

throw ex;           

}

 }

When i create AddFieldObject then it return the error as following :

{System.ArgumentException: Value does not fall within the expected range.
   at CRAXDDRT.SectionClass.AddFieldObject(Object Field, Int32 Left, Int32 Top)
   at WebApplication1.DynamicBinding.CrystalReportDynamicDataBind() in D:\Jeyaseelan\DotNetPracticals2005\WebApplication1\WebApplication1\DynamicBinding.aspx.cs:line 85}

Could anybody tell me what is the exact problem. But AddTextObject is working fine, AddFieldObject is the only problem. Members please help me or just give the code of how to use CRAXDDRT 11.0.

 

Thanks in Advance,
Winner
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.035 seconds.