0

我正在做需要水晶报表 9 和 vb6 的项目。

我创建了一个水晶报表页面,并选择了我想要的所有列。

然后在表单用户中通过此代码选择数据

If frmRepTabaee1.Check1.Value = 1 And frmRepTabaee1.chbTamin.Value = 1 Then
     If frmRepTabaee1.txtTabai.Text = 1 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman1,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 2 Then
            sqlStr = "select pcode,name,lastname,TTaminDarman2,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 3 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman3,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 4 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman4,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 5 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman5,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"
              ElseIf frmRepTabaee1.txtTabai.Text = 6 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman6,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

    End If
End If

Screen.MousePointer = vbHourglass

rs.Open sqlStr, cn


Report.Database.SetDataSource rs, , 1

'--------------------------------
'''''''''''''''''''''''''''''''''

'''''''''''''''''''''
'-------------------
CRViewer91.Refresh
'-------------------

CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
'End If
End Sub

问题 :

当 sql 查询使用不同的列进行选择并且导致水晶报表 9 中的 null 问题时,如何设置 null 的默认值?

在VB6&水晶报表9

谢谢

4

1 回答 1

0

我没有第 9 版,但是在 Crystal Reports 常规设置的某个报表选项中,您应该有Convert Database NULL Values to DefaultConvert Other NULL Values to Default复选框。检查这些应该可以消除您的错误。在此处输入图像描述

于 2013-07-05T15:31:31.273 回答