Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Crystal Reports?

Crystal Reports?

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marix
    wrote on last edited by
    #1

    I need to make a new crystal report at runtime! So I make new instance of crystal report wich has only title and datetime fileds. So I need to add columns and datasource to it. But how I do not know! is there any way how to add datafields to report? there is only a method for setting datasource. Can anyone help me out? thanx a lot

    U 1 Reply Last reply
    0
    • M Marix

      I need to make a new crystal report at runtime! So I make new instance of crystal report wich has only title and datetime fileds. So I need to add columns and datasource to it. But how I do not know! is there any way how to add datafields to report? there is only a method for setting datasource. Can anyone help me out? thanx a lot

      U Offline
      U Offline
      User 565426
      wrote on last edited by
      #2

      You'll want to start by creating a data schema for your data source and adding this too your project. You can do this by either using datasource.WriteXmlSchema() or by hand. Once you have the schema in your project go into you report and right click anywhere on it and select Database->Add/Remove Database. You should see your dataset under Project data-> ADO .NET datasets. Now all of the tables and fields from that dataset should be added to the Field explorer in the report, go ahead and drag them on too the report. Once you have laid out your report you can use the following code to assign the dataset too it: MyReport oRpt = New MyReport oRpt.SetDataSource(mydataset) CrystalReportViewer1.DisplayGroupTree = False CrystalReportViewer1.ShowGroupTreeButton = False CrystalReportViewer1.ReportSource = oRpt

      U M 2 Replies Last reply
      0
      • U User 565426

        You'll want to start by creating a data schema for your data source and adding this too your project. You can do this by either using datasource.WriteXmlSchema() or by hand. Once you have the schema in your project go into you report and right click anywhere on it and select Database->Add/Remove Database. You should see your dataset under Project data-> ADO .NET datasets. Now all of the tables and fields from that dataset should be added to the Field explorer in the report, go ahead and drag them on too the report. Once you have laid out your report you can use the following code to assign the dataset too it: MyReport oRpt = New MyReport oRpt.SetDataSource(mydataset) CrystalReportViewer1.DisplayGroupTree = False CrystalReportViewer1.ShowGroupTreeButton = False CrystalReportViewer1.ReportSource = oRpt

        U Offline
        U Offline
        User 565426
        wrote on last edited by
        #3

        oops...forgot I was in the C# forum. The above code is in vb .net, if you need any help converting it, let me know.

        1 Reply Last reply
        0
        • U User 565426

          You'll want to start by creating a data schema for your data source and adding this too your project. You can do this by either using datasource.WriteXmlSchema() or by hand. Once you have the schema in your project go into you report and right click anywhere on it and select Database->Add/Remove Database. You should see your dataset under Project data-> ADO .NET datasets. Now all of the tables and fields from that dataset should be added to the Field explorer in the report, go ahead and drag them on too the report. Once you have laid out your report you can use the following code to assign the dataset too it: MyReport oRpt = New MyReport oRpt.SetDataSource(mydataset) CrystalReportViewer1.DisplayGroupTree = False CrystalReportViewer1.ShowGroupTreeButton = False CrystalReportViewer1.ReportSource = oRpt

          M Offline
          M Offline
          Marix
          wrote on last edited by
          #4

          No, the thing is that I do not know what kind of table I will use in advance. What I need is application that gets a dataset with one table that need to reported! So I do not know how to build a report from a scratch. I know how to set a datasource for report but how to add columns (fields) to it I do not know! Of course if it is possible at all.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups