VB6 + crystal报告9空值

时间:2013-07-05 12:13:27

标签: vb6 crystal-reports report

我正在研究需要水晶报告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

感谢

1 个答案:

答案 0 :(得分:0)

我没有版本9,但在Crystal Reports报表选项的常规设置中,您应该有将数据库NULL值转换为默认值将其他NULL值转换为默认值的复选框即可。检查这些应该可以消除您的错误。enter image description here