Click here to Skip to main content
11,409,766 members (45,584 online)
Rate this: bad
Please Sign up or sign in to vote.
good day!! correct my post if im at the wrong thread.. by the way sirs/mams

im having a problem generating a report using crystal report.. ahmm im building a medical record system for our company and im having a problem using crystal report because it generating data but.. its not accurate...

here are some screen shots.. for you guys..[^]

here is the query result at MSSQL SERVER 2005[^]

here is my Code in the form ReportViewer

	Private Sub InitializeData()
        Dim objReporting As New ReportingDataService
        Dim rpt As rptBloodDonation = Nothing
        rpt = New rptBloodDonation
        With objReporting
            Select Case Me.Tag.ToString
                Case "Blood Donation Report"
                    .DateFrom = dateFrom
                    .DateTo = dateTo
                    .BloodDonation(My.Settings.dbMSConnectionString, rpt, Me.crViewer, _
                                   My.Settings.UserName, My.Settings.PassWord, My.Settings.ServerName)
            End Select
        End With
    End Sub

and here is my code for report generation...

 Private Sub DatabaseQuery(ByRef strQuery As String, ByVal strFilter As String)
        Select Case strFilter
            Case "BloodDonation"
                strQuery = "SELECT [newIDNO] ,MR.[Emp_WholeName] , " 
                strQuery &= "[dateExtract] ,[bloodType], "
                strQuery &= "[qtyExtract] ,[donated] "
                strQuery &= "FROM [Tbl_Medical_BloodDonation] TBLMBD "
                strQuery &= "INNER JOIN [PIS_Master_Record] MR ON MR.[Emp_CurrentID] = TBLMBD.[newIDNO] "
                strQuery &= "where [dateExtract] BETWEEN '" & CDate(Me._dateFrom).ToString("yyyy-MM-dd") & "' AND '" & CDate(Me._dateTo).ToString("yyyy-MM-dd") & "' "
                strQuery &= "ORDER BY [newIDNO] ASC, MR.[Emp_WholeName] ASC"
        End Select
    End Sub
    Public Sub BloodDonation(ByVal strDBConnectionString As String, ByVal rptDocument As ReportDocument, _
                             ByRef crReportViewer As CrystalReportViewer, ByVal strUser As String, _
                             ByVal strPass As String, ByVal strServer As String)
        Dim sqlCon As New SqlConnection(strDBConnectionString)
        Dim strSqlQuery As String = String.Empty
        Call DatabaseQuery(strSqlQuery, "BloodDonation")
        Dim sqlCmd As New SqlCommand(strSqlQuery, sqlCon)
        Dim sqlAdapter As New SqlDataAdapter
        sqlAdapter.SelectCommand = sqlCmd
        Dim dt As New Data.DataTable
        Dim strParameterValue As String = CDate(Me._dateFrom).ToString("MMMM, dd, yyyy").ToUpper & " TO " & CDate(Me._dateTo).ToString("MMMM, dd, yyyy").ToUpper
        With rptDocument
            .SetDatabaseLogon(strUser, strPass, strServer, sqlCon.Database)
            .SetParameterValue("dtRange", strParameterValue)
            crReportViewer.ReportSource = rptDocument
        End With
    End Sub	

hope this can give you details on how my problem is doing.....

thanks in advance for the reply.. and help!!
Posted 17-Jan-13 14:50pm
Edited 17-Jan-13 14:52pm
Teju MB at 17-Jan-13 22:59pm
What is the problem are you facing?
Is it that in your query execution you are getting 2 rows of data and in report 6 rows of data.
Which CR version you are using , My opinion to check your "SET LOCATION" and DSN for the report.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 300
1 OriginalGriff 285
2 Dave Kreskowiak 115
3 Andy Lanng 115
4 Maciej Los 100
0 Sergey Alexandrovich Kryukov 8,731
1 OriginalGriff 6,895
2 Maciej Los 3,332
3 Abhinav S 3,248
4 Peter Leow 3,059

Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100