With DataDirectory Keyword: CrystalReports.Load, CrystalReports.SetDataSource Yields Password Prompt

C

clusardi2k

Hello, the steps that I did to get to my current question are:

I began to use the keyword DataDirectory and the next line of code.
When I ran the application, I would be asked for a Login ID and
password. If I clicked the cancell button on that Login window I would
not see the report at all.

CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt")

So, I eventually tried the following 2 line code sequece. This time
if I pressed the cancell button on the Login window it would show the
report.

CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt")
CrystalReport1.SetDataSource(Employee_DatabaseDataSet)

Question: The last 2 lines of code will display the report and I'm
pleased with that. But, how can I stop the Login prompt? I want to just

open the report without being asked for Login ID or password.

If I change the Load to any of the next two lines nothing happens
differently from the just using the two lines above.

CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt",
CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)


CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt",
CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)

Trying to finish-up a project,
Christopher Lusardi
 
C

clusardi2k

I modied the code to below but the application still asks for Login
ID/Password. What should I do?

Thanks,
Christopher Lusardi

Private Sub Open_Report_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Open_Report.Click
Dim CrystalReport1 As New ReportDocument

EMPLOYEEDataGridView.Visible = False
EMPLOYEEDataGridView.Enabled = False

Me.WindowState = FormWindowState.Maximized

CrystalReportViewer1.Enabled = True
CrystalReportViewer1.Visible = True

CrystalReport1.FileName = Application.StartupPath &
"\..\..\CrystalReport1.rpt"

'CrystalReport1.SetDatabaseLogon("", "", "",
Application.StartupPath & "\..\..\CrystalReport1.rpt")
'CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt")


Me.EMPLOYEETableAdapter.Fill(Me.Employee_DatabaseDataSet.EMPLOYEE)

CrystalReport1.SetDataSource(Employee_DatabaseDataSet)

CrystalReportViewer1.ReportSource = CrystalReport1

CrystalReportViewer1.Zoom(150)
Close_Report.Visible = True
Close_Report.Enabled = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top