Click here to Skip to main content
12,302,330 members (58,589 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB SQL-Server VS2010 VB.NET , +
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

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...

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 17-Jan-13 13:50pm
Edited 17-Jan-13 13:52pm
v2
Comments
Teju MB 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160530.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2016
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