harshilpatel
Programmer
Hi All,
I am working on Vb.net application with oracle as my database. I have developed reports using crystal report 9. Usually when you open reports directly in crystal report viewer control it prompts you for any necessary login information. My goal was to provide the login information by means of code, so that the user is not prompted for any login information. I tried to write the following code to achieve that purpose. On running the code I get the error Invalid report source. I know the same code works if I create a report with SQL server as my database. Can you point what might be possibly wrong in my code.
Code:
-----------------------------------------------------------
Dim CrReportDocument As ReportDocument
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
CrReportDocument = New ReportDocument()
CrReportDocument.Load("C:\Report4.rpt"
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.DatabaseName = ""
.Password = "xyz"
.ServerName = "xyz"
.UserID = "xyz"
End With
crDatabase = CrReportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
' crv is crystal report viewer control
crv.ReportSource = CrReportDocument
I am working on Vb.net application with oracle as my database. I have developed reports using crystal report 9. Usually when you open reports directly in crystal report viewer control it prompts you for any necessary login information. My goal was to provide the login information by means of code, so that the user is not prompted for any login information. I tried to write the following code to achieve that purpose. On running the code I get the error Invalid report source. I know the same code works if I create a report with SQL server as my database. Can you point what might be possibly wrong in my code.
Code:
-----------------------------------------------------------
Dim CrReportDocument As ReportDocument
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
CrReportDocument = New ReportDocument()
CrReportDocument.Load("C:\Report4.rpt"
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.DatabaseName = ""
.Password = "xyz"
.ServerName = "xyz"
.UserID = "xyz"
End With
crDatabase = CrReportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
' crv is crystal report viewer control
crv.ReportSource = CrReportDocument