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