crystal reports + dataset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Flupke
    New Member
    • Mar 2008
    • 4

    crystal reports + dataset

    Hello, I'm trying to figure out how to create a Crystal Report in VB2005 using a CrystalReportVi ewer from a dataset that I created on a form Form1. The dataset (from an Access Database) appears on a DatagridView on Form1, assuring me that there is nothing wrong with thre creation of the dataset itself. However , I cannot make it appear in the Report Viewer. The error that constantly throws up is : "Report has no tables". This is my code :

    Dim rpt as new CrystalReport
    Dim mds As New DataSet
    mds = ........ (creation of a dataset)

    rpt.SetDataSour ce(mds)
    CrystalReportVi ewer1.ReportSou rce = rpt

    When running this code, the dataset is created and appears in a datagridvieuw, but the report remains empty.
    Have I skipped a crucial step ? I would appreciate to receive help from anyone on short notice, as I have to finish a project including several reports by the end of April.

    I read the answers on simmilar quetions on the forum, but I don't see the answer to my question.

    Greetings !

    Flupke
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Hey there!

    You probably have already seen this out there:

    [CODE=VB]

    Dim CrystalReportVi ewer1 As CrystalDecision s.Windows.Forms .CrystalReportV iewer = New CrystalDecision s.Windows.Forms .CrystalReportV iewer
    Dim Report As CrystalDecision s.CrystalReport s.Engine.Report Document = New CrystalDecision s.CrystalReport s.Engine.Report Document
    CrystalReportVi ewer1.ActiveVie wIndex = 0
    CrystalReportVi ewer1.BorderSty le = System.Windows. Forms.BorderSty le.FixedSingle
    CrystalReportVi ewer1.DisplayGr oupTree = False
    CrystalReportVi ewer1.Dock = System.Windows. Forms.DockStyle .Fill
    CrystalReportVi ewer1.Location = New System.Drawing. Point(0, 0)
    CrystalReportVi ewer1.Name = "CrystalReportV iewer1"

    Dim QueryString As String = "select * from TableName" 'Your Query here
    Dim Connection As New OleDbConnection (funcs.con) 'Your Database Connection Here
    Connection.Open ()

    Dim Adapter As OleDbDataAdapte r = New OleDbDataAdapte r(querystring, connection)'Pas sing the query in the connection
    Dim DataSet As DataSet = New DataSet() 'DataSet
    Adapter.Fill(Da taSet)
    Dim DataTable As DataTable = New DataTable 'DataTable
    DataTable = DataSet.Tables( 0) 'filling the datatable here
    Report.Load(App lication.Startu pPath & "/ReportName.rpt" ) 'Report Name Here
    Report.SetDataS ource(DataTable )
    CrystalReportVi ewer1.ReportSou rce = Report

    [/CODE]

    Not too skilled in Crystal, see what this does for ya...

    Also get some step by step here:

    In the following walkthrough we'll create a Report Server Project which features barcode images by using Barcode Professional, Visual Studio 2005 or SQL Server Business Intelligence Development Studio, and Reporting Services 2005.


    Please fetch results through this forum, just to see if anything already posted.

    In a bit!

    Dököll

    Comment

    Working...