Print Page | Close Window

Using a dataset as datasource

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=215
Printed Date: 03 May 2024 at 8:57am


Topic: Using a dataset as datasource
Posted By: Jason
Subject: Using a dataset as datasource
Date Posted: 16 Feb 2007 at 4:01am
Hi - i'm a new user to this forum.  I'm using VS2005 

 
I have a report which takes information from an access database.  The database has a password.  I want the report to work without prompting the user for a password.  Looking at various posting i've tried to make the report use a dataset for the datasource

Private Report32 As InspectorErrorReport

    Dim Rdataset As ReportDataSet

    Dim Rtable As ReportDataSet.InspectorFaultTableDataTable

    Dim Radapter As ReportDataSetTableAdapters.InspectorFaultAdapter

 

 

Private Sub ReportForm_Load(ByVal sender As Object, ByVal e As system.EventArgs) Handles Me.Load

 

Rdataset = New ReportDataSet

Radapter = New ReportDataSetTableAdapters.InspectorFaultAdapter

Rtable = New ReportDataSet.InspectorFaultTableDataTable

 

 

Rtable.Clear()

Radapter.Fill(Rtable)

 

Report32 = New InspectorErrorReport

Report32.SetDataSource(Rtable)

CrystalReportViewer1.ReportSource = Report32

CrystalReportViewer1.DisplayGroupTree = False

  

End Sub

The error that i keep getting is

Overload resolution failed because no accessible 'SetDataSource' is most specific for these arguments: 'Public Overridable Sub SetDataSource(dataTable As System.Data.DataTable)': Not most specific. 'Public Overridable Sub SetDataSource(enumerable As  System.Collections.IEnumerable)': Not most specific.

Please can anyone help.  Thanks in advance




Replies:
Posted By: hilfy
Date Posted: 02 Mar 2007 at 11:35am
Instead of creating a new DataTable, have you tried just setting it like this:
 
Report32.SetDataSource(ReportDataSet.InspectorFaultTableDataTable)
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Jason
Date Posted: 05 Mar 2007 at 2:57am
just tried to set it as suggested but still no success Cry 
Thanks anyway.
 
If anyone else has any suggestions I would be grateful.  This is a problem I just can't find a work around and its driving me nuts.
 


Posted By: hilfy
Date Posted: 05 Mar 2007 at 10:17am
I work in C#, not in VB, but here's what I've done in the past in a Windows app:
 
In the code for the viewer form, I modify the constructor to take a DataSet as a parameter.  The main code for the viewer form looks like this:

public ViewerForm(DataSet ds)
{
  InitializeComponent();
  ConfigureCrystalReports(ds);
}

private void ConfigureCrystalReports(DataSet ds)

{
  rpt =
new BOEUserAuditRpt();
  rpt.SetDataSource(ds);
  rptViewer.ReportSource = auditRpt;
}[\code]
 
The code that calls this looks like this:[code]

private void RunReport()

{
  ViewerForm viewer =
new BOEAuditRptViewer(dsAuditInfo);
  viewer.Show();
}
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window