473,388 Members | 1,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Object Reference not set

Hi,

I keep getting this error every time I try to load
crystalreportviewer on a webform with a dataset.

Here is the error:
--------------------------------------------------------
Server Error in '/Cr_Dataset' 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:

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:
[NullReferenceException: Object reference not set to an
instance of an object.]
CrystalDecisions.Web..get_7() +189
CrystalDecisions.Web.CrystalReportViewer.OnInit
(EventArgs e) +352
System.Web.UI.Control.InitRecursive(Control
namingContainer) +235
System.Web.UI.Control.InitRecursive(Control
namingContainer) +179
System.Web.UI.Control.InitRecursive(Control
namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +171


----------------------------------------------------------
Here is my code:
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Public Class view1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As
CrystalDecisions.Web.CrystalReportViewer
Protected Const strConnection As String = _
"driver={SQL .....)"

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim rpt As New CrystalReport1() 'The report you
created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New Dataset1() 'The DataSet you
created.

Try

myConnection = New SqlConnection(strConnection)
MyCommand.Connection = myConnection
MyCommand.CommandText = "Select * from
vwPayerSummary"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand

myDA.Fill(myDS, "vwPayerSummary")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt

Catch Excep As Exception
'MessageBox.Show(Excep.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

End Class

Any help is appereciated.

Thanks

Pranav

This is what I found on your site

-----------------------------
FIX: Invalid Object in ASP Session State
The information in this article applies to:
Microsoft Visual Studio .NET (2002), Professional
Edition
Microsoft Visual Studio .NET (2002), Professional
Edition SP1
Microsoft Visual Studio .NET (2002), Enterprise
Architect Edition
Microsoft Visual Studio .NET (2002), Enterprise
Architect Edition SP1
Microsoft Visual Studio .NET (2002), Enterprise
Developer Edition
Microsoft Visual Studio .NET (2002), Enterprise
Developer Edition SP1
SYMPTOMS
A .NET-connected Web application stores an object in the
session state. When you leave the application idle for 12
to 20 minutes, and then try again to gain access to the
object, you may receive an invalid object exception error
message such as the following:
Server Error in '/TheTest Application' 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.
RESOLUTION
A supported fix is now available from Microsoft, but it is
only intended to correct the problem that is described in
this article. Apply it only to systems that are
experiencing this specific problem.

Note You must have a Visual Studio license agreement to
obtain this fix.

To resolve this problem, contact Microsoft Product Support
Services to obtain the fix. For a complete list of
Microsoft Product Support Services phone numbers and
information about support costs, visit the following
Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-
US;CNTACTMS
Note In special cases, charges that are ordinarily
incurred for support calls may be canceled if a Microsoft
Support Professional determines that a specific update
will resolve your problem. The usual support costs will
apply to additional support questions and issues that do
not qualify for the specific update in question.
Last Reviewed: 2/14/2003
Keywords: kbQFE kberrmsg kbfix kbBug KB810245
Jul 19 '05 #1
2 10498
I was doing virtually the same thing and my problem turned
out to be a permissions issue. I had to grant the aSPNET
account Full Access to the crystal directory as well as
the winnt\microsoft.net\framework\v1.x.xxxxx\ directory to
solve the problem. The error is pretty generic so you
could also have a data problem. You may want to verify
that the data is being retrieved by setting on the
datatables in the ds to a datagrid, e.g.

Datagrid1.datasource = myDS.Table1
Datagrid1.Databind
-----Original Message-----
Hi,

I keep getting this error every time I try to load
crystalreportviewer on a webform with a dataset.

Here is the error:
--------------------------------------------------------
Server Error in '/Cr_Dataset' 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:

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:
[NullReferenceException: Object reference not set to an
instance of an object.]
CrystalDecisions.Web..get_7() +189
CrystalDecisions.Web.CrystalReportViewer.OnInit
(EventArgs e) +352
System.Web.UI.Control.InitRecursive(Control
namingContainer) +235
System.Web.UI.Control.InitRecursive(Control
namingContainer) +179
System.Web.UI.Control.InitRecursive(Control
namingContainer) +179
System.Web.UI.Page.ProcessRequestMain() +171


----------------------------------------------------------
Here is my code:
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Public Class view1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As
CrystalDecisions.Web.CrystalReportViewer
Protected Const strConnection As String = _
"driver={SQL .....)"

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim rpt As New CrystalReport1() 'The report you
created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New Dataset1() 'The DataSet you
created.

Try

myConnection = New SqlConnection (strConnection) MyCommand.Connection = myConnection
MyCommand.CommandText = "Select * from
vwPayerSummary"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand

myDA.Fill(myDS, "vwPayerSummary")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt

Catch Excep As Exception
'MessageBox.Show(Excep.Message, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

End Class

Any help is appereciated.

Thanks

Pranav

This is what I found on your site

-----------------------------
FIX: Invalid Object in ASP Session State
The information in this article applies to:
Microsoft Visual Studio .NET (2002), Professional
Edition
Microsoft Visual Studio .NET (2002), Professional
Edition SP1
Microsoft Visual Studio .NET (2002), Enterprise
Architect Edition
Microsoft Visual Studio .NET (2002), Enterprise
Architect Edition SP1
Microsoft Visual Studio .NET (2002), Enterprise
Developer Edition
Microsoft Visual Studio .NET (2002), Enterprise
Developer Edition SP1
SYMPTOMS
A .NET-connected Web application stores an object in the
session state. When you leave the application idle for 12
to 20 minutes, and then try again to gain access to the
object, you may receive an invalid object exception error
message such as the following:
Server Error in '/TheTest Application' 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.
RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in
this article. Apply it only to systems that are
experiencing this specific problem.

Note You must have a Visual Studio license agreement to
obtain this fix.

To resolve this problem, contact Microsoft Product Support Services to obtain the fix. For a complete list of
Microsoft Product Support Services phone numbers and
information about support costs, visit the following
Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-
US;CNTACTMS
Note In special cases, charges that are ordinarily
incurred for support calls may be canceled if a Microsoft
Support Professional determines that a specific update
will resolve your problem. The usual support costs will
apply to additional support questions and issues that do
not qualify for the specific update in question.
Last Reviewed: 2/14/2003
Keywords: kbQFE kberrmsg kbfix kbBug KB810245
.

Jul 19 '05 #2


Hi Alex,

Thanks for your reply. I am new to .net. I am hoping that you have the
time to show me how and where to set the permissions. I get this error
even before the page loads.

Thanks again for your response.

Pkpatel

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chris S. | last post by:
I'm trying to make a graphical editor and browser for Pickled files. One aspect I'm not sure about is how to detect multiple references to the same data. For instance, say I had the Pickled...
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
29
by: web1110 | last post by:
If I have 2 variables, A and B, referencing the same object and then do a A.Dispose(), what happens to B?
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.