on 02-17-2017 10:24 AM
I'd struck for this problem by almost 2 full days ... hoping any guys can give little help to me ....
I need to issue several reports by using asp.net and crystal report :
The report data are queried by the asp code and using custom class which having the same structures as those defined by the xsd files.
Below code is used to generate the custom dataset from database
Public Function GetDsClaimMonthlyReport(ByVal dFm As DateTime) As DsRptMonthlyClaimReport
Dim ds As New DsRptMonthlyClaimReport
Dim sql As String
sql = "SELECT TypeCode, Seq, Channel, TypeDesc, ReportDate, Submission, Paid, Declined, Closed, Withdrawn, Outstanding, TotalPaym FROM vwMonthlyClaimReport " + _
" WHERE ReportDate=@SubmissionDateFm "
'parameters
Dim paramList(1) As SqlParameter
paramList(0) = New SqlParameter("@SubmissionDateFm", DbType.DateTime)
paramList(0).Value = dFm
SQLHelper.FillDataset(ConnString, CommandType.Text, sql, ds, New String() {ds.Tables(0).TableName}, paramList)
Return ds
End Function
Then specifying the dataset to report document:
Dim rpt As New RptMonthlyClaims
Dim da As New DLReport
Dim ds As DataSet
Dim dsm As DataSet
Dim dsClaimChange As DataSet
Dim dsTAT As DataSet
Dim rptD As New ReportDocument
Dim fileName As String
Dim now As DateTime
now = DateTime.Now.Date
Dim dFm As DateTime
Dim dTo As DateTime
'first day of last month
dFm = now.AddDays(now.Day * -1 + 1).AddMonths(-1)
dTo = now.AddDays(now.Day * -1)
gIdentityContext = CType(gASPNET, System.Security.Principal.WindowsIdentity).Impersonate
rpt.SetParameterValue("@dateFm", dFm)
rpt.SetParameterValue("@dateTo", dTo)
gIdentityContext.Undo()
Dim subRpt As SubreportObject
ds = da.GetDsClaimMonthlyReport(dFm)
'WL
subRpt = rpt.secWL.ReportObjects("Subreport1")
rptD = subRpt.OpenSubreport("RptMonthlyClaimsSubWL.rpt")
rptD.SetDataSource(ds)
....
The xsd schema using for the report:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DsRptMonthlyClaimReport" targetNamespace="http://tempuri.org/DsRptMonthlyClaimReport.xsd"
elementFormDefault="qualified" attributeFormDefault="qualified" xmlns="http://tempuri.org/DsRptMonthlyClaimReport.xsd"
xmlns:mstns="http://tempuri.org/DsRptMonthlyClaimReport.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DsRptMonthlyClaimReport" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="vwMonthlyClaimReport">
<xs:complexType>
<xs:sequence>
<xs:element name="TypeCode" type="xs:string" />
<xs:element name="Seq" type="xs:int" minOccurs="0" />
<xs:element name="Channel" type="xs:string" />
<xs:element name="TypeDesc" type="xs:string" minOccurs="0" />
<xs:element name="ReportDate" type="xs:dateTime" />
<xs:element name="Submission" type="xs:decimal" minOccurs="0" />
<xs:element name="Paid" type="xs:decimal" minOccurs="0" />
<xs:element name="Declined" type="xs:decimal" minOccurs="0" />
<xs:element name="Closed" type="xs:decimal" minOccurs="0" />
<xs:element name="Withdrawn" type="xs:decimal" minOccurs="0" />
<xs:element name="Outstanding" type="xs:decimal" minOccurs="0" />
<xs:element name="TotalPaym" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
The most weird thing is using the same xsd and logic to generate report with no subreport is pretty fine, but if i set the datasource within subreport ... the datasetconversion exception will be threw ....
I had tried for many findings from google ... and still can't figure out the problem .... I am having no idea for the issue ....
There is no runtime with Crystal Reports, go here to get the .NET SDK package, first link to integrate into VS, all other are redist packages, do not install them on your DEV PC.
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
Check permissions where the XML is located.
Try Fiddler to see if has access to it.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.