Hi,
It may be your authorization. Try something like this before calling the
reportsource:
Dim crtablelogoninfos As New TableLogOnInfos
Dim crtablelogoninfo As New TableLogOnInfo
Dim crconnectioninfo As New ConnectionInfo
Dim crtables As Tables
Dim crtable As Table
Dim tablecounter As Integer
crreportdocument.Load(gl_browseprintvar,
OpenReportMethod.OpenReportByTempCopy)
With crconnectioninfo
..DatabaseName = "IMC"
..ServerName = globalservername
..UserID = globalusername
..Password = globalpwd
End With
crtablelogoninfo.ConnectionInfo = crconnectioninfo
crtables = crreportdocument.Database.Tables
For Each crtable In crtables
If (Mid(crtable.Name, 1, 4) = "magt" Or Mid(crtable.Name, 1, 23) =
"sp_createmagtbaseselect" Or Mid(crtable.Name, 1, 4) = "magb" Or
Mid(crtable.Name, 1, 4) = "magf") And gl_browseprintvar =
"f:\imcapps\hvsum.rpt" Then
crconnectioninfo.DatabaseName = "imc_extra"
crtablelogoninfo.ConnectionInfo = crconnectioninfo
Else
crconnectioninfo.DatabaseName = "IMC"
crtablelogoninfo.ConnectionInfo = crconnectioninfo
End If
crtable.ApplyLogOnInfo(crtablelogoninfo)
crtable.Location = crtable.Name
Next
Dim subRepDoc As New ReportDocument
Dim crSection As Section
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
'If you have any sub-reports, they need the connection info too...
For Each crSection In crreportdocument.ReportDefinition.Sections
For Each crReportObject In crSection.ReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
crSubreportObject = CType(crReportObject, SubreportObject)
subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
For Each crtable In subRepDoc.Database.Tables
crtable.ApplyLogOnInfo(crtablelogoninfo)
crtable.Location = crtable.Name
Next
End If
Next
Next
CrystalReportViewer1.ReportSource = crreportdocument
HTH,
Bernie Yaeger
"zdrakec" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all:
>
> I have the Crystal Report viewer imbedded on a .NET form, and it works
> very well... except, on the target machine, when I set the ReportSource
> property of the viewer (to a ReportDocument object), it PRETENDS to
> load a report, but displays a blank object. The toolbar becomes active,
> the navigation buttons are active, but otherwise the viewer does not
> have the report loaded. Clicking the "Refresh" button of the viewer at
> this point actually results in the report toolbar being disabled.
>
> Mind you, the component is correctly registered via the merge modules,
> and the database authentication is handled in the code. In fact, the
> app works perfectly IF the target machine happens to have VS.NET
> installed.
> But for other machines, the report viewer throws no exception, just
> displays a blank... doesn't even prompt for parameters.
>
> Suggestions?
>
> Cheers,
> zdrakec
>
|