Error setting Server logon info
Hi,
I get the following error when I try to connect to my server to run a crystal report and it highlights the code in purple:
Object reference not set to an instance of an object
The code works fine without the parameter, but I don't know why it is not working with the parameter added.
rpt =
New CrystalReport1()Dim reportPathAsString ="C:\Crystal Report\Crystalreport1.rpt"Dim myConnectionInfoAs CrystalDecisions.Shared.ConnectionInfo =New CrystalDecisions.Shared.ConnectionInfo()myConnectionInfo.ServerName =
[servername here]myConnectionInfo.DatabaseName =
"[database name here]"myConnectionInfo.UserID =
"[user name here]"myConnectionInfo.Password =
"[password here]"Dim myTableLogOnInfosAs CrystalDecisions.Shared.TableLogOnInfos = CView.LogOnInfoForEach myTableLogOnInfoAs CrystalDecisions.Shared.TableLogOnInfoIn myTableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
CView.ReportSource = rpt
Dim field1As ParameterField =Me.CView.ParameterFieldInfo(0)Dim val1As ParameterDiscreteValue =New ParameterDiscreteValueval1.Value =
"2/20/2007"field1.CurrentValues.Add(val1)
rpt.Load(reportPath)
I would really appretiate the help.
Lawrence

