Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / May 2006

Tip: Looking for answers? Try searching our database.

Crystal Reports SetDataSource Method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JT - 03 May 2006 19:04 GMT
In upgrading a Windows Forms project from 2003 to 2005 in VB.Net, I have
errors in setting the datasource for all of my embedded Crystal Report
objects.

What was working in 1.1 was

If Me.myDataAdapter.Fill(Me.myDataSet.myDataTable) > 0 Then
                   Dim oRpt As ReportClass = New myReport
                   oRpt.SetDataSource(Me.myDataSet.myDataTable)
                   Me.CrystalReportViewer1.ReportSource = oRpt
                   Return
Else : GoTo NODATA

End If

On conversion, every one of these method calls gives the error:

error BC30521: 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.

Any help on how to fix this would be appreciated.  Thanks.

Signature

John

Linda Liu [MSFT] - 04 May 2006 12:44 GMT
Hi John,

Thank you for posting.

In VS2005, the SetDataSource() method of a CrystalReport has has four
override functions. They are SetDataSource(DataSet),
SetDataSource(DataTable), SetDataSource(IDataReader) and
SetDataSource(IEnumerable). If you pass a strong-typed DataTable to the
SetDataSource() method like the following:
oRpt.SetDataSource(Me.myDataSet.myDataTable), the VS2005 compiler consider
this call ambiguous between the SetDataSource(DataTable) method and the
SetDataSource(IEnumerable) method.

To fix the problem, you should cast the datatable instance to DataTable
type. The following is a sample.

oRpt.SetDataSource((DataTable)Me.myDataSet.myDataTable);

Hope this is helpful to you.
If you have any other concerns or need anything else, please don't hesitate
to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.