Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: Using a dataset as datasource Post Reply Post New Topic
Author Message
Jason
Newbie
Newbie
Avatar

Joined: 16 Feb 2007
Online Status: Offline
Posts: 2
Quote Jason Replybullet Topic: Using a dataset as datasource
    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

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
Jason
Newbie
Newbie
Avatar

Joined: 16 Feb 2007
Online Status: Offline
Posts: 2
Quote Jason Replybullet 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.
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.