crystal report database fields blannk

thejeraldo

Well-known member
Joined
Jun 9, 2009
Messages
70
Location
Philippines
Programming Experience
1-3
i have a report that has database fields.. if all of the fields has values the report is show without problem. but if one field is blank from the database then others will not show up as well. im passing a parameter by vb.net but i dont seem to understand why other fields will not show if only one is blank, they are not even related. pls help.
 

mH_p0rtal

Well-known member
Joined
Oct 17, 2006
Messages
61
Location
Persia
Programming Experience
3-5
i just leave a field blank , but crystall report is still working , there is no logical reason for being like that , please give us more detail or give some parts of ur source code
 

thejeraldo

Well-known member
Joined
Jun 9, 2009
Messages
70
Location
Philippines
Programming Experience
1-3
well my command query is like this:
VB.NET:
SELECT * FROM tblEmployee WHERE SystemID={?PSystemID}
VB.NET:
SELECT * FROM tblPersonalInfo WHERE SystemID={?PSystemID}
then my code to call the report is like this:
VB.NET:
Private Sub cmdReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReport.Click
        Dim cryRpt As New ReportDocument
        cryRpt.Load("C:\HRIS\HRIS\Reports\rptEmployeeDetail.rpt")

        Dim pFields As New ParameterFields()
        Dim pField As New ParameterField()
        Dim disVal As New ParameterDiscreteValue()
        'Dim rVal As New ParameterRangeValue()
        pField.Name = "PSystemID"
        disVal.Value = Emp 'Employee number
        pField.CurrentValues.Add(disVal)
        pFields.Add(pField)

        With frmEmpReports
            .ReportViewer1.ReportSource = cryRpt
            .ReportViewer1.Refresh()
            .ReportViewer1.Zoom(75)
            .ReportViewer1.ParameterFieldInfo = pFields
            .ReportViewer1.Refresh()
        End With
        frmEmpReports.Show()
    End Sub
the report should look like this:




if crystal report has a problem with other database fields affecting other database fields because if it has null values then is there any exception for this?

ive tried catching the exception (general exception only) but nothiong showed up.

thanks a lot.
 

Tom

Well-known member
Joined
Aug 23, 2005
Messages
746
Programming Experience
5-10
I forget the reasoning for it (its been a long time) but I remember an error a co-worker used to get where the reports were appearing blank in the crViewer. The first page was blank but if you hit the next page icon, the data showed on the next page in the viewer. As I said I dont know if its related, just an old probelm I recall occurring.
 

mH_p0rtal

Well-known member
Joined
Oct 17, 2006
Messages
61
Location
Persia
Programming Experience
3-5
take a look at this example
i have a database that contains a table w two columns
in a button i place this code
VB.NET:
      Db3DataSet.Clear()
        Dim ma As New OleDb.OleDbCommand

        ma = New OleDb.OleDbCommand("select Name from friends", aa)
        ira.SelectCommand = ma
        ira.Fill(Me.Db3DataSet.Friends)

        rpt.SetDataSource(Db3DataSet)
        CrystalReportViewer1.ReportSource = rpt
& another button
VB.NET:
        FriendsTableAdapter.Fill(Db3DataSet.Friends)



        rpt.SetDataSource(Db3DataSet)
        CrystalReportViewer1.ReportSource = rpt
those are my vars
VB.NET:
  Dim rpt As New CrystalReport1
    Dim ira As New OleDbDataAdapter
    Dim aa As New OleDbConnection
so with these codes i have no problem with my crystall report
i meant that i have some blanks fields , beside in a button that i didn't use of my second column ( select Name from friends )
but its still working
if you couldn't figure out whats going on , you can post your database or your database structure here , I'll make the appropriate crystall report viewer for you
 

thejeraldo

Well-known member
Joined
Jun 9, 2009
Messages
70
Location
Philippines
Programming Experience
1-3
ok i finally found out a solution for my problem.. i just made the fields in my table to "not accept null" and then i set default value to ''

hope this could help somebody. thanks guys.
 
Top Bottom