I'm sure I have the terminology wrong, but here's what I did...
1) I created a view in the database containing the fields needed
2) I then created a dataset in .Net to use as the database source for the report
This game me a design time connection to the data for drop/drag, etc..
After designing, the code behind the report page is: (Notice PopulateData that returns a datatable from the ES Query.
(this is what happens when you take an old cobol programmer and force him to code in .NET with out proper training :) )
Code:
Imports System
Imports System.Data
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports cwr
Partial Class CWReport1
Inherits System.Web.UI.Page
Private RptData As DataTable
Protected Sub CrystalReportViewer1_Navigate(ByVal source As Object, ByVal e As CrystalDecisions.Web.NavigateEventArgs) Handles CrystalReportViewer1.Navigate
Dim rep As New ReportDocument
rep.Load(Server.MapPath("CWReport1.rpt"))
rep.SetDataSource(PopulateData())
Me.CrystalReportViewer1.ReportSource = rep
End Sub
Private Function PopulateData() As DataTable
Dim Vrep As CWR.VREPORTQuery = New CWR.VREPORTQuery
Dim VrepColl As CWR.VREPORTCollection = New CWR.VREPORTCollection
Dim FromDate As String
Dim ThruDate As String
FromDate = Session.Item("Report_FromDate")
ThruDate = Session.Item("Report_ThruDate")
Vrep.Select()
If FromDate > "" And ThruDate > "" Then
Vrep.Where(Vrep.BEGMONDAY.LessThan(CDate(ThruDate)))
Vrep.Where(Vrep.ENDSUNDAY.GreaterThan(CDate(FromDate)))
End If
VrepColl.Load(Vrep)
Dim Dtx As DataTable = New DataTable
Dtx = VrepColl.Query.LoadDataTable
Return Dtx
End Function
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
CrystalReportViewer1_Navigate(Nothing, Nothing)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class