Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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..

http://social.msdn.microsoft.com/Forums/getfile/222245[^]

here is the query result at MSSQL SERVER 2005

http://social.msdn.microsoft.com/Forums/getfile/222247[^]

here is my Code in the form ReportViewer

VB
Private Sub InitializeData()

    Dim objReporting As New ReportingDataService

    Dim rpt As rptBloodDonation = Nothing

    rpt = New rptBloodDonation
    rpt.Refresh()
    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...

VB
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

       sqlAdapter.Fill(dt)

       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)
           .SetDataSource(dt)
           .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
Updated 17-Jan-13 13:52pm
v2
Comments
The Doer 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900