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. Web Development
  3. ASP.NET
  4. Help with Crystal Reports [modified]

Help with Crystal Reports [modified]

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-netdesignsysadmin
2 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.
  • C Offline
    C Offline
    callousfantom
    wrote on last edited by
    #1

    Hi. I'm rather new to asp.net and even more so in crystal. Basically this is the first time I'm using this. What I need to do is prepare a report from a dynamically created dataset(untyped if you will). I have read a lot of articles online but haven't been able to make it work. Basically the table that i want to display in crystal doesn't exist in database and was created programmatically as a DataTable The data simply doesn't display.Here's the code in codebehind: Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init Dim rpt As New ReportDocument rpt.Load(Server.MapPath("CrystalReport1.rpt") rpt.SetDataSource(dset.Tables("Tab1")) CrystalReportViewer1.ReportSource = rpt CrystalReportViewer1.DataBind() End Sub Please note that the dataset is populated correctly as i can see it in a gridview. CrystalReport1.rpt uses the same schema as Tab1 but using a dataset included at design time called "DataSet1". Here is the code for how this dataset was created: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Dim mysqlDad As MySqlDataAdapter Dim mysqlConn As MySqlConnection Dim query As String = "" 'some select query that returns 2 rows. Dim connstring As String = "Database=ocsweb;Data Source=10.135.158.160;User Id=abc;Password=abc" dset = New DataSet("Home") dset.ReadXmlSchema(Server.MapPath("~\App_Code\DataSet1.xsd")) mysqlConn = New MySqlConnection(connstring) mysqlDad = New MySqlDataAdapter(query, mysqlConn) mysqlDad.Fill(dset, "Tab1_tmp") Dim Dt As New DataTable("Tab1") Dim col1 As New DataColumn("Unchecked") Dim col2 As New DataColumn("Checked") Dt.Columns.Add(col1) Dt.Columns.Add(col2) Dim dr As DataRow = Dt.NewRow() dr.Item(0) = dset.Tables("Tab1_tmp").Rows(0).Item(0) dr.Item(1) = dset.Tables("Tab1_tmp").Rows(1).Item(0) Dt.Rows.Add(dr) dset.Tables.Add(Dt) catch ex as exception msgbox(ex.message) end try If there is something else that can/needs to be done, please let me know. I'm very new and could surely use some help here. :(

    modified on Friday, August 28, 2009 6:18 AM

    S 1 Reply Last reply
    0
    • C callousfantom

      Hi. I'm rather new to asp.net and even more so in crystal. Basically this is the first time I'm using this. What I need to do is prepare a report from a dynamically created dataset(untyped if you will). I have read a lot of articles online but haven't been able to make it work. Basically the table that i want to display in crystal doesn't exist in database and was created programmatically as a DataTable The data simply doesn't display.Here's the code in codebehind: Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init Dim rpt As New ReportDocument rpt.Load(Server.MapPath("CrystalReport1.rpt") rpt.SetDataSource(dset.Tables("Tab1")) CrystalReportViewer1.ReportSource = rpt CrystalReportViewer1.DataBind() End Sub Please note that the dataset is populated correctly as i can see it in a gridview. CrystalReport1.rpt uses the same schema as Tab1 but using a dataset included at design time called "DataSet1". Here is the code for how this dataset was created: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Dim mysqlDad As MySqlDataAdapter Dim mysqlConn As MySqlConnection Dim query As String = "" 'some select query that returns 2 rows. Dim connstring As String = "Database=ocsweb;Data Source=10.135.158.160;User Id=abc;Password=abc" dset = New DataSet("Home") dset.ReadXmlSchema(Server.MapPath("~\App_Code\DataSet1.xsd")) mysqlConn = New MySqlConnection(connstring) mysqlDad = New MySqlDataAdapter(query, mysqlConn) mysqlDad.Fill(dset, "Tab1_tmp") Dim Dt As New DataTable("Tab1") Dim col1 As New DataColumn("Unchecked") Dim col2 As New DataColumn("Checked") Dt.Columns.Add(col1) Dt.Columns.Add(col2) Dim dr As DataRow = Dt.NewRow() dr.Item(0) = dset.Tables("Tab1_tmp").Rows(0).Item(0) dr.Item(1) = dset.Tables("Tab1_tmp").Rows(1).Item(0) Dt.Rows.Add(dr) dset.Tables.Add(Dt) catch ex as exception msgbox(ex.message) end try If there is something else that can/needs to be done, please let me know. I'm very new and could surely use some help here. :(

      modified on Friday, August 28, 2009 6:18 AM

      S Offline
      S Offline
      Satish Mahapatra
      wrote on last edited by
      #2

      Try with button click event instead of pageload to bind the dataset to report and see

      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