Crystal Reports Error Invalid Object Type ( logOnInfo) -
06-30-2003
, 10:09 AM
I am trying to get an ASP.NET app working. RUnning on my machine works
fine.
I am deploying to a server with an MSI. The app runs fine except when
I try a page with a crystal report. I get a vague error
""
Invalid object type.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Invalid object type.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Invalid object type.]
CrystalDecisions.Shared.TableLogOnInfos.Add(Object logOnInfo) +73
Surveys.stats.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
""
If I comment out the code
"
CrystalReportViewer1.LogOnInfo.Add(myLogin)
"
I get no error. But, I also dont get the report to show. Just a blank
page.
HERE IS MY CODE FOR THE PAGE
---------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strUserName As String
Dim strSlashPosition As Integer
Dim intProjectNo As Integer
'get the project number fropm the URL
intProjectNo = CInt(Request.QueryString.Get("project"))
'get users name
strSlashPosition = InStr(1, User.Identity.Name, "\")
strUserName = Mid$(User.Identity.Name, strSlashPosition + 1,
Len(User.Identity.Name) - strSlashPosition)
'Put user code to initialize the page here
Dim crpt As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
crpt = New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
crpt.Load("c:\\inetpub\wwwroot\closeoutsurveys\ove rall.rpt")
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = "NHSSQ03"
myLogin.ConnectionInfo.DatabaseName = "lpdev"
myLogin.ConnectionInfo.Password = "rnasa"
myLogin.ConnectionInfo.UserID = "rnasa"
myTable.ApplyLogOnInfo(myLogin)
Next
'give report login info
CrystalReportViewer1.LogOnInfo.Add(myLogin)
CrystalReportViewer1.ReportSource = crpt
CrystalReportViewer1.DataBind()
End Sub
------------------------------------- |