SetDataSource not working with Crystal Reports .NET in VB.NET 
Author Message
 SetDataSource not working with Crystal Reports .NET in VB.NET

Below is the code I use to show a report through a report viewer
control.  It seems to work fine, except that it displays all the data
in the selected view, rather than just the data defined by the "where"
clause as I've typed below.  I've tried about a million different
combinations of properties and methods, none of which make a
difference, and the help files seem to indicate that I'm doing this
right.  Can someone tell me why the "setdatasource" doesn't seem to be
doing its job?  Thanks,


        Dim myReport As New
        Dim objTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim objLoginInfo As CrystalDecisions.Shared.TableLogOnInfo
        Dim dsNetwork As New DataSet()

        sReport = System.Configuration.ConfigurationSettings.AppSettings("report_path")
& "\myReport.rpt"
        Dim strNetworkSQL As String = "select * from myView where
season_id = " & g_yearID
        Dim daNetwork As New SqlDataAdapter(strNetworkSQL, g_oConn)
        For Each objTable In myReport.Database.Tables
            objLoginInfo = objTable.LogOnInfo
            objLoginInfo.ConnectionInfo.Password = "xxx"
        Dim frmReport As New frmReportPreview()
        frmReport.ReportViewer.ReportSource = myReport
        frmReport.ReportViewer.DisplayGroupTree = False
        Cursor.Current = Cursors.Default

Fri, 22 Jul 2005 22:55:58 GMT  
 SetDataSource not working with Crystal Reports .NET in VB.NET
Never mind about the problem above.  Finally got it working by
changing this line:

>         myReport.SetDataSource(dsNetwork)

to this line:


Don't know why it's necessary to add the "tables" part, as it doesn't
seem to say anything about that in the help.

In any case, now I have another question.  Does anyone know how to
design a Crystal Report using the design wizard (.NET version), when
the underlying query you want to design it from is actually a function
call (rather than a table or view)?


Sat, 23 Jul 2005 22:35:58 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

2. vb .net crystal reports not compatible with Crystal Reports 8.5

3. and crystal Multiple reports

4. Exporting crystal reports from visual is not working in the final release

5. i am using and crystal reports for visual

6. Error in temp file in running crystal report for .net in

7. Crystal Reports from ASP.NET without compiling VB.NET on SQL/ADO changes

8. Web Reports (ASP.NET and Crystal Reports for .Net)

9. Crystal Reports Does Not Show in VisualStudio(VB).Net Server Explorer

10. report from created (temporary) table

11. problem with crystal report for .net in

12. Linking Crystal Report with a stored Procedure -- crystal report for visual


Powered by phpBB® Forum Software