passing null parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CharChabil
    New Member
    • Oct 2006
    • 17

    passing null parameter

    Code:
    Private Sub BPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BPrint.Click
    Dim frm As New FrmPrintReport 'reports
    Dim cr As New CRepResponsable
    cr.SetParameterValue(0, Val(Me.TBAccountNumber.Text))'integer
    cr.SetParameterValue(1, Me.TBAccountNumber.Text)'string
    cr.SetParameterValue(2, vbNull) 'integer
    cr.SetParameterValue(3, vbNull) 'string
    
    frm.CrystalReportViewer.ReportSource = cr
    frm.MdiParent = Me.MdiParent
    frm.Show()
    End Sub
    
    i have the code above. i could not pass a null parameter, to the crystal reports. i will have an empty report  i tried vbnull.null and vbnull.empty same result.
    but if I put
    cr.SetParameterValue(2, Val(Me.TBSubAccount.Text))) 'integer 'not null
    cr.SetParameterValue(3, Me.TBSubAccount.Text) 'string 'not null
    the report display the values.
    here is the select expert formula (CR):
    Code:
    {CUSTOMERS.SUB_ACCOUNT_NUMBER} = {?SubAccount_String} and
    {ecole.serial} = {?AccountNumber} and
    {CUSTOMERS.ACCOUNT_NUMBER} = {?AccountNumber_String} and
    {ecole.sub_account} = {?SubAccount}
    How could i pass a null parameter?
  • bplacker
    New Member
    • Sep 2006
    • 121

    #2
    you can't just pass "" as an empty string instead of a null value?

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      Have you tried DBNull.Value?

      Hope that this helps.

      Comment

      Working...