[dba-VS] Report Generator in VS
Charlotte Foust
charlotte.foust at gmail.com
Sun Apr 5 20:39:28 CDT 2015
Dan,
I built reports in .Net when I was employed full time, but we used a suite
of 3rd party tools, so I haven't really worked with the built in tools
much. Just trying to rewrap my head around them.
Charlotte Foust
(916) 206-4336
On Sun, Apr 5, 2015 at 10:04 AM, Dan Waters <df.waters at outlook.com> wrote:
> Hi Charlotte,
>
>
>
> This is an example of code behind a form which contains a ReportViewer.
> Once you begin learning how to use reports in VS, refer back to this code.
> This is some very hard-earned experience! ;-)
>
>
>
> I’m showing how to pass information to the report form from the calling
> procedure, and that one form can be designed to display as many different
> reports as you wish (assuming they all have the same exterior dimensions,
> i.e., Portrait, Landscape, etc).
>
>
>
> I use LinqToSQL queries as the data access method. The two variables
> which begin with ‘LQ’ are those queries. Of course, you can set up the
> DataSource with other methods also.
>
>
>
> Good Luck!
>
> Dan
>
>
>
> ‘------------------------------------------------------------
>
>
>
> Public Sub New(stgNameOfReport As String, Optional stgQueryInfo As
> String = "", Optional intCellID As Integer = 0)
>
> MyBase.New()
>
> InitializeComponent()
>
> If stgNameOfReport = "" Then Exit Sub
>
> Me.Text = "Report Data"
>
> Call ReportList(stgNameOfReport, stgQueryInfo)
>
> End Sub
>
> Private Sub ReportList(stgNameOfReport As String, Optional
> stgQueryInfo As String = "", Optional intID As Integer = 0)
>
> Dim LQCurrentReport
>
> Dim stgReportTitle As String = ""
>
> Dim DCAppMain As New
> DCAppMainDataContext(SV.ConnectionStringServer)
>
> Dim rds = New ReportDataSource()
>
> Select Case stgNameOfReport
>
> Case "All Records"
>
> stgReportTitle = "All Records"
>
> LQCurrentReport = (From a In
> DCAppMain.vewStandardReport
>
> Select New fakStandardReport With { _
>
> .MainID = a.MainID, _
>
> .Stage = a.Stage, _
>
> .AssessorDate = a.AssessorDate, _
>
> .ClosedDate = a.ClosedDate, _
>
> .Opportunity = a.Opportunity, _
>
> .DueDate = a.DueDate, _
>
> .CompletedDate = a.CompletedDate, _
>
> .Score = a.Score, _
>
> .AceCell =
> GlobalProcedures.GetAceCellName(a.AceCellID), _
>
> .AceCellSub =
> GlobalProcedures.GetAceCellName(a.AceCellSubID), _
>
> .Assessor =
> PeopleProcedures.GetFullName(a.AssessorID), _
>
> .AssignedTo =
> PeopleProcedures.GetFullName(a.AssignedToID), _
>
> .CompletedBy =
> PeopleProcedures.GetFullName(a.CompletedByID), _
>
> .CompletedOpportunity =
> a.CompletedOpportunity, _
>
> .OpportunityID = a.OpportunityID}).ToList()
>
> Me.FakStandardReportBindingSource.DataSource =
> LQCurrentReport
>
>
> ReportViewerTable.LocalReport.ReportEmbeddedResource =
> "PSIAppMain.rptStandardReport.rdlc"
>
>
>
> Case "ScoringDescriptions"
>
> stgReportTitle = " Scoring Descriptions"
>
> Dim LQScoringDescriptions = From a In
> DCAppMain.tblExplanations
>
>
> Order By a.ScoreSort
>
>
> Select a.ExplanationID, a.ScoreSort, a.Selection, a.Point0Report,
> a.Point1Report, a.Point2Report, a.Point3Report, a.Point4Report,
> a.Point5Report
>
>
> Me.fakScoringDescriptionsBindingSource.DataSource = LQScoringDescriptions
>
>
> ReportViewerTable.LocalReport.ReportEmbeddedResource =
> "PSIAppMain.rptScoringDescriptions.rdlc"
>
> End Select
>
> rds.Name = "fakStandardReport"
>
> rds.Value = FakStandardReportBindingSource
>
> ReportViewerTable.LocalReport.DataSources.Add(rds)
>
> '-- Set the criteria textboxes on the report
>
> Dim paramList As New Generic.List(Of ReportParameter)
>
> paramList.Add(New ReportParameter("ReportTitle",
> SV.SystemAcronym & " - " & stgReportTitle, True))
>
> paramList.Add(New ReportParameter("ReportFooter",
> Utility.ReportFooter, True))
>
> Me.ReportViewerTable.LocalReport.SetParameters(paramList)
>
> Me.ReportViewerTable.RefreshReport()
>
> Me.ReportViewerTable.Dock = DockStyle.Fill
>
> End Sub
>
> ‘------------------------------------------------------------------------
>
>
>
>
>
> From: dba-VS [mailto:dba-vs-bounces at databaseadvisors.com] On Behalf Of
> Charlotte Foust
> Sent: Saturday, April 04, 2015 3:57 PM
> To: dba-vs at databaseadvisors.com
> Subject: [dba-VS] Report Generator in VS
>
>
>
> What do you guys use to generate reports in Visual Studio. I know a lot
> of people use Crystal Reports, but I hate that option.
>
>
>
>
>
> Charlotte Foust
>
> (916) 206-4336
>
> _______________________________________________
> dba-VS mailing list
> dba-VS at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vs
> http://www.databaseadvisors.com
>
More information about the dba-VS
mailing list