我在VB6里调用水晶报表,其实实现的功能就是打印一些报表,这些表的格式我通过rpt文件做好,然后调用.我的程序是C/S模式的。有一个服务器,数据库是SQLSERVER2000.奇怪的现象是:在服务器端运行程序,这个水晶报表打开完全正常,但是在每个客户端运行程序,调用,出现得是水晶报表的格式有,但是里面的数据就没有出现.
调用的格式会出现,但是有些里面的数据项内容就没有显示,不知道怎么回事????

解决方案 »

  1.   

    用wise打包,直接又对水晶报表9的打包
      

  2.   

     '清除报表中保持的数据
      objCRReport.DiscardSavedData
    '如果还不行的话就按4F的试试
      

  3.   

    赋值前先执行
      objCRReport.DiscardSavedData 
      

  4.   

    调用水晶报表的按钮地方:
    '----------调用水晶报表-----------
    Private Sub CmdPrint_Click()
       Dim frmPShow As New frmPrintPage
       If CmbTerm.Text = "" And CmbTeachar.Text = "" Then
          MsgBox "打印条件不能为空!", vbCritical, "信息提示"
       Else
          If CmbTeachar.Text = "所有信息" Then
             strSQL = "select Course_detail.Teachar,ProfessionTable.ProfName,Course_detail.CourseName from Course_detail,ProfessionTable,Course_main where Course_main.Term='" + m_strTerm + "' and Course_main.C_id = Course_detail.C_id and Course_main.p_id = ProfessionTable.treepID"
          Else
             strSQL = "select Course_detail.Teachar,ProfessionTable.ProfName,Course_detail.CourseName from Course_detail,ProfessionTable,Course_main where Course_main.Term='" + m_strTerm + "' and Course_main.C_id = Course_detail.C_id and Course_detail.Teachar='" + m_strTeachar + "' and Course_main.p_id = ProfessionTable.treepID"
          End If
          frmPShow.show
       End If
       Unload Me
    End Sub水晶报表载入的时候,即formload的地方
    Private Sub Form_Load()
    '   On Error GoTo err
       
       strPath = App.Path + "\" + "MyRpt.rpt"
       
       Set capp = New CRAXDRT.Application
        Set carp = capp.OpenReport(strPath, crOpenReportByDefault)'    If rstPrint.state = adStateOpen Then rstPrint.Close
    '    With rstPrint
    '           .ActiveConnection = g_Conn
    '           .CursorLocation = adUseClient
    '           .Open strSQL, g_Conn, adOpenDynamic, adLockOptimistic
    '    End With
        For Each moxData In carp.Database.Tables
            Call moxData.SetLogOnInfo("(local)", "", "sa", "sa")   '估计这个语句有问题,这里写了local
        Next    carp.SQLQueryString = Trim(strSQL)
       
        CRViewer91.ReportSource = carp
        CRViewer91.Zoom 100
        CRViewer91.ViewReport
        CRViewer91.Zoom 100
        Screen.MousePointer = vbDefault'Exit Sub
    'err:
      '  MsgBox "打印预览失败!", vbExclamation + vbOKOnly, "信息提示!"
    End Sub