why it gives an error in crystal report?
-
hi to all, i am new in asp.net, i want to create parameterised crystal report. i did it i create parameter "Empid " using "Parameter Fields" then i want to show the report on click event of button so code is as follows,
Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click Dim ConnInfo As New ConnectionInfo With ConnInfo .ServerName = ".sqlexpress" .DatabaseName = "Northwind" .UserID = "sa" .Password = "" End With Me.CrystalReportViewer1.ParameterFieldInfo.Clear() If Me.txtEmployeeID.Text.Trim.Length > 0 Then Me.CrystalReportViewer1.ReportSource = Server.MapPath("SampleParam1.rpt") Dim ParamFields As ParameterFields = Me.CrystalReportViewer1.ParameterFieldInfo Dim p_EmpID As New ParameterField p_EmpID.Name = "p_EmployeeID" Dim p_EmpID_Value As New ParameterDiscreteValue p_EmpID_Value.Value = Me.txtEmployeeID.Text p_EmpID.CurrentValues.Add(p_EmpID_Value) ParamFields.Add(p_EmpID) Else Me.CrystalReportViewer1.ReportSource = Server.MapPath("SampleRpt01.rpt") End If For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo cnInfo.ConnectionInfo = ConnInfo Next Me.CrystalReportViewer1.RefreshReport() End Sub
i am using sql2000, but after the clicking on button it will show me an error ,"Object Reference not set to an instance of an object". why i gives me error? is the servername is wrong? what the name should i provide? my database is on another computer and i am accessing it through networking the name of the computer is "RS1" so should i give the servername="RS1" if i debug the code , CrystalReportViewer1.LogOnInfo have count=0. what is error?