Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to load and display report from xml file, i was able to do this using crystal report, i am having some difficulties doing this with microsoft report. please anyone know how to do this?

here is my code using crystal report:

The XML File:

HTML
 <pre><xs:schema id="PersonalKYCRep" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="CorpKYCDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="CorpKYCReportFile">
          <xs:complexType>
            <xs:sequence>
             
              <xs:element name="ContactName" type="xs:string" minOccurs="0" />
              <xs:element name="ContactPhone" type="xs:string" minOccurs="0" />
              <xs:element name="ContactEmail" type="xs:string" minOccurs="0" />
              <xs:element name="CurrentAddress1" type="xs:string" minOccurs="0" />
              <xs:element name="CurrentAddress2" type="xs:string" minOccurs="0" />
              <xs:element name="CurrentCity" type="xs:string" minOccurs="0" />
              <xs:element name="CurrentState" type="xs:string" minOccurs="0" />
              
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>


The C# Code:

C#
ReportDocument NRep = new ReportDocument();

public void filler(String table, int ind)
    {
        if (ind == 0)
            myDataSet.Clear();
        myAdapter.Fill(myDataSet, table);
    }

public DataSet corDetail(string RecordID, int source)
    {

using (SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            myConn.Open();
           
            SqlCommand cmd = new SqlCommand("AVS_usp_GetPhcnByIDReport", myConn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@RecordID", SqlDbType.VarChar).Value = RecordID;
            cmd.Parameters.Add("@source", SqlDbType.Int).Value = source;
            //SqlDataReader rdr = new SqlDataReader();

            myAdapter = new SqlDataAdapter() ;
            myDataSet = new DataSet();
            myAdapter.SelectCommand = cmd;
            if (source == 1)
            {
                filler("PersonalKYCRep", 0);
            }
            else
            {
                filler("SubReportFile", 0);
            }
            return myDataSet;
        }
    }
}


Please any assistance will be appreciated. Thanks in advance
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900