【问题标题】:VB6 + crystal Report 9 null valueVB6+水晶报表9空值
【发布时间】:2013-07-05 12:13:26
【问题描述】:

我正在做需要 Crystal 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中

谢谢

【问题讨论】:

    标签: vb6 crystal-reports report


    【解决方案1】:

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

    【讨论】:

    • CR9 中没有这样的选项
    • @madman 版本 8 和 2008 有它,所以它也必须存在于版本 9 中。尝试查看文件 - 报告选项。
    猜你喜欢
    • 1970-01-01
    • 2013-03-09
    • 1970-01-01
    • 1970-01-01
    • 2010-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多