B
Bill Schanks
I have a VB.NET 2005 Winform app that has a crystal report. It comes
up fine when I run the app on the Dev machine. But when I run the app
on a users machine, even logged in as myself, I get prompted for a
user name and password. And even then it won't pull up the report.
The crystal report is sourced via a stored procedure. I choose OLD DB
(ADO) as the connection source. I couldn't get it to work with an
ADO.NET Dataset that I setup in the project.
Here is the code to pull the report:
Try
'Update UI
_frmMain.ssStatus.Text = "Getting report results"
Cursor = Cursors.WaitCursor
Dim x As
CrystalDecisions.CrystalReports.Engine.ReportDocument
'Generate the rpt
x = New
CrystalDecisions.CrystalReports.Engine.ReportDocument
x.Load(Me.txtHiddenFileName.Text)
'Parms (If enabled)
x.SetParameterValue("@RptDate", CDate(Me.cbAsOf.Text))
'If CBool(Me.cbRptID.Tag) AndAlso Not
String.IsNullOrEmpty(Me.cbRptID.Text) Then _
' x.SetParameterValue("@ParmName", "")
'Code the rest...
'Show the report
CrystalReportViewer1.Visible = True
CrystalReportViewer1.ReportSource = x
CrystalReportViewer1.Zoom(1) 'Page Width
Catch ex As Exception
HandledExceptionManager.ShowDialog("An error occured while
attemting to " _
& "pull the requested report.", _
"Your report could not be retrieved.", _
"Evaluate the error, and re-try the command. If you
need assistance, " _
& "Click Help/About for contact info.", _
ex, _
MessageBoxButtons.OK, _
MessageBoxIcon.Error, _
HandledExceptionManager.UserErrorDefaultButton.Default)
Finally
Cursor = Cursors.Default
_frmMain.ssStatus.Text = "Ready"
End Try
up fine when I run the app on the Dev machine. But when I run the app
on a users machine, even logged in as myself, I get prompted for a
user name and password. And even then it won't pull up the report.
The crystal report is sourced via a stored procedure. I choose OLD DB
(ADO) as the connection source. I couldn't get it to work with an
ADO.NET Dataset that I setup in the project.
Here is the code to pull the report:
Try
'Update UI
_frmMain.ssStatus.Text = "Getting report results"
Cursor = Cursors.WaitCursor
Dim x As
CrystalDecisions.CrystalReports.Engine.ReportDocument
'Generate the rpt
x = New
CrystalDecisions.CrystalReports.Engine.ReportDocument
x.Load(Me.txtHiddenFileName.Text)
'Parms (If enabled)
x.SetParameterValue("@RptDate", CDate(Me.cbAsOf.Text))
'If CBool(Me.cbRptID.Tag) AndAlso Not
String.IsNullOrEmpty(Me.cbRptID.Text) Then _
' x.SetParameterValue("@ParmName", "")
'Code the rest...
'Show the report
CrystalReportViewer1.Visible = True
CrystalReportViewer1.ReportSource = x
CrystalReportViewer1.Zoom(1) 'Page Width
Catch ex As Exception
HandledExceptionManager.ShowDialog("An error occured while
attemting to " _
& "pull the requested report.", _
"Your report could not be retrieved.", _
"Evaluate the error, and re-try the command. If you
need assistance, " _
& "Click Help/About for contact info.", _
ex, _
MessageBoxButtons.OK, _
MessageBoxIcon.Error, _
HandledExceptionManager.UserErrorDefaultButton.Default)
Finally
Cursor = Cursors.Default
_frmMain.ssStatus.Text = "Ready"
End Try