Hi,
I went through an article by emoreau: and created my report and I am able to view the data. These r the steps I followed. I created an xsd schema file with the same column names as returned by my dataset object.
myobj_Dataset is populated with data returned by the function from business myobj_getQuery.QueryDataGe
t( val1 val2, ) where QueryDataGet is the method in the business layer that retuns dataset.
My xsd schema file is as follows:
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-micr
osoft-com:
officedata
">
<xsd:element name="Table">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Commodity" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="year_2001" minOccurs="0" od:jetType="double" od:sqlSType="float" type="xsd:double"/>
<xsd:element name="year_2002" minOccurs="0" od:jetType="double" od:sqlSType="float" type="xsd:double"/>
<xsd:element name="commodity_Type" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="commodity_Code" minOccurs="0" od:jetType="text" od:sqlSType="nvarchar">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I use this code to bind my dataset to rpt
crpt = New ReportDocument
crpt.Load(Server.MapPath("
~/Report/t
est1.rpt")
)
'Pass the dataset to the report
crpt.SetDataSource(obj_Dat
aset)
'Pass the Report Document object to the viewer
CrystalReportViewer1.Repor
tSource = crpt
CrystalReportViewer1.DataB
ind()
but my problem is that even though the number of columns returned by the dataset and the datatype will remain the same but the field names will be different for eg my report start year is this year -7 years so my end year is 2008 the start year is 2001 but next year it will be 2002 to 2009 so the field names returned by the dataset will be
value_2002 , value_2003 and so on. wheras my data definition on field explorer is value_2001, value_2002 and so will my page header change. My question is in this scenario is the approach I am following will work or throw error ?
This is very urgent since I am confused at this point but i am sure there should be a solution for this.
Start Free Trial