Skip to Content
avatar image
Former Member issue report by using xsd as datasource throwing datasetconversion exception

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 and crystal report :

  • SAP Crystal Repoort 2016 Support Pack 3 - Version
  • Visual Studio 2015 - Version 14.0.24720.00 Update 1

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 "
            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)
            Dim subRpt As SubreportObject
            ds = da.GetDsClaimMonthlyReport(dFm)
            subRpt = rpt.secWL.ReportObjects("Subreport1")
            rptD = subRpt.OpenSubreport("RptMonthlyClaimsSubWL.rpt")

The xsd schema using for the report:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DsRptMonthlyClaimReport" targetNamespace=""
	elementFormDefault="qualified" attributeFormDefault="qualified" xmlns=""
	xmlns:mstns="" xmlns:xs=""
	<xs:element name="DsRptMonthlyClaimReport" msdata:IsDataSet="true">
			<xs:choice maxOccurs="unbounded">
				<xs:element name="vwMonthlyClaimReport">
							<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" />

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 ....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 21, 2017 at 09:19 PM

    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.

    Check permissions where the XML is located.

    Try Fiddler to see if has access to it.


    Add comment
    10|10000 characters needed characters exceeded