on 05-09-2010 7:50 AM
Hi I created form using vb 2008 contains crystalreportviewer and in load sub I wrote the following code to show the report:
Dim r_select As String
Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
r_select = "Select Innovative_Form.* from Innovative_Form"
Dim da As OleDbDataAdapter = New OleDbDataAdapter(r_select, System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString())
Dim da33 As New System.Data.DataSet
da.Fill(da33, "DataTable1")
MyReport.Load(Server.MapPath("CrystalReport.rpt"))
MyReport.SetDataSource(da33)
Me.CrystalReportViewer1.ReportSource = MyReport
Me.CrystalReportViewer1.DisplayGroupTree = False
Me.CrystalReportViewer1.DataBind()
Me.CrystalReportViewer1.ShowFirstPage()
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
End Sub
when run I got the following error
Server Error in '/Innovation Last Version-10-1-10' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 34:
Line 35:
Line 36: Dim da As OleDbDataAdapter = New OleDbDataAdapter(r_select, System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString())
Line 37:
Line 38:
Source File: C:\Users\kisruser\Desktop\PROJECTS\Innovate Project\Innovation Last Version-10-1-10\Report.aspx.vb Line: 36
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Report.Page_Load(Object sender, EventArgs e) in C:\Users\kisruser\Desktop\PROJECTS\Innovate Project\Innovation Last Version-10-1-10\Report.aspx.vb:36
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016
SO WHAT IS THE PROBLEM?????
What version of CR are you using?
What CR updates are you using?
See sample apps here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
in particular check out vbnet_win_pass_dataset_main_sub.zip
The [Crystal Reports for Visual Studio 2005 Walkthroughs|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23] will also be good to look at.
Ludek
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Moved to .NET Developer Forum.
Search here for that error also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.