locked
ADO.net with crystal report

    Question

  •  

    Can any one help me the following?

     

     I need to create the crystal report for our projects. Each project data are stored on different database. The database change based on the project selection.  My code is here

     

    Dim objrpt As New ReportDocument

                        dtSet = New DataSet

              sqlString = "sqlquery"

              conString = ConfigurationSettings.AppSettings("ConnectionString") + database

              adapter = New SqlDataAdapter(sqlString, conString)

              adapter.Fill(dtSet)

              dtset = Session.Contents("dtset")

              objrpt.Load(Server.MapPath("CrystalReport1.rpt"))

               objrpt.SetDataSource(dtset)

              CrystalReportViewer1.ReportSource = objrpt

              CrystalReportViewer1.DataBind()

     

    This code is working fine but I could not see any data in the webform.

     

    Note: I can’t create the typed dataset for my project because I don’t know which database and table to be used at design time. I can get database and table details only at the runtime. I generate the sql query dynamically. I just include the crystal report form in my project. I haven’t done any configuration (database connection, chat …) on it.  My question is.

     

     

    1)    How do I see the data in the web form? Should I need to change any settings on the crystal report?

    2)       I want to populate this data in to the bar chart. Is it possible?

     

    You are greatly appreciated if you help me on this… Thanks in advance.

     

    Senthil

    Thursday, December 27, 2007 8:31 PM

Answers

  • folks,

     

        I find out the solution for this issue.  the solution is

     

    Dim objrpt As New ReportDocument

                        dtSet = New DataSet

              sqlString = "sqlquery"

              conString = ConfigurationSettings.AppSettings("ConnectionString") + database

              adapter = New SqlDataAdapter(sqlString, conString)

              adapter.Fill(dtSet)

     

    '''write the data into XML file and use this xml file in the crystal report '''datasource. if you have any qustion on that, let me know

     

    dtSet.WriteXml(Server.MapPath("dashboard") + "myData.xml")

              objrpt.Load(Server.MapPath("CrystalReport1.rpt"))

               objrpt.SetDataSource(dtset)

              CrystalReportViewer1.ReportSource = objrpt

              CrystalReportViewer1.DataBind()

     

    Now it is working good and happy with this.  I have one more question for you guys,

     

      how can i create the bar chat using the result set?. any help is appriciated...

     

    Thanks,

    Senthil

    Friday, December 28, 2007 9:16 PM

All replies

  • Hi guys,

     

       is there any updates on this?.

    Friday, December 28, 2007 5:51 PM
  • folks,

     

        I find out the solution for this issue.  the solution is

     

    Dim objrpt As New ReportDocument

                        dtSet = New DataSet

              sqlString = "sqlquery"

              conString = ConfigurationSettings.AppSettings("ConnectionString") + database

              adapter = New SqlDataAdapter(sqlString, conString)

              adapter.Fill(dtSet)

     

    '''write the data into XML file and use this xml file in the crystal report '''datasource. if you have any qustion on that, let me know

     

    dtSet.WriteXml(Server.MapPath("dashboard") + "myData.xml")

              objrpt.Load(Server.MapPath("CrystalReport1.rpt"))

               objrpt.SetDataSource(dtset)

              CrystalReportViewer1.ReportSource = objrpt

              CrystalReportViewer1.DataBind()

     

    Now it is working good and happy with this.  I have one more question for you guys,

     

      how can i create the bar chat using the result set?. any help is appriciated...

     

    Thanks,

    Senthil

    Friday, December 28, 2007 9:16 PM