PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

asp to asp.net with block variable not set error

 
 
amitbadgi@gmail.com
Guest
Posts: n/a
 
      4th Aug 2005
I am getting this error for a file while converting an asp application
to asp.net
Object variable or With block variable not set.
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 variable or
With block variable not set.

Source Error:


Line 166: </tr>
Line 167: <% Dim rs As Object
Line 168: If Not rs.EOF Then
Line 169: Do While Not rs.EOF
Line 170:


Source File: C:\Documents and
Settings\amit\WebSite1\reports\default.aspx Line: 168

Stack Trace:


[NullReferenceException: Object variable or With block variable not
set.]
Microsoft.VisualBasic.CompilerServices.Container..ctor(Object
Instance) +232124
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +142
ASP.default_aspx.__Render__control1(HtmlTextWriter __w, Control
parameterContainer) in C:\Documents and
Settings\amit\WebSite1\reports\default.aspx:168
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +280
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+8878


Thanks in advance

 
Reply With Quote
 
 
 
 
Peter van der Goes
Guest
Posts: n/a
 
      4th Aug 2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am getting this error for a file while converting an asp application
> to asp.net
> Object variable or With block variable not set.
> 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 variable or
> With block variable not set.
>
> Source Error:
>
>
> Line 166: </tr>
> Line 167: <% Dim rs As Object
> Line 168: If Not rs.EOF Then
> Line 169: Do While Not rs.EOF
> Line 170:
>
>
> Source File: C:\Documents and
> Settings\amit\WebSite1\reports\default.aspx Line: 168
>


(from what you've shown) In line 167 you create a reference to an object of
type Object, but not an actual object. Thus, rs is an empty (null)
reference. In line 168, you attempt to use the null reference to qualify use
of the EOF, which fails because rs does not point to an object.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.


 
Reply With Quote
 
amitbadgi@gmail.com
Guest
Posts: n/a
 
      5th Aug 2005
Hello Peter, Thankx for your reply, i wanted to know that since i am
just creating a reference and thus how do i fix it, am i supp to
initialize a value or sthing, please let me know. thankyou
Peter van der Goes wrote:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am getting this error for a file while converting an asp application
> > to asp.net
> > Object variable or With block variable not set.
> > 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 variable or
> > With block variable not set.
> >
> > Source Error:
> >
> >
> > Line 166: </tr>
> > Line 167: <% Dim rs As Object
> > Line 168: If Not rs.EOF Then
> > Line 169: Do While Not rs.EOF
> > Line 170:
> >
> >
> > Source File: C:\Documents and
> > Settings\amit\WebSite1\reports\default.aspx Line: 168
> >

>
> (from what you've shown) In line 167 you create a reference to an object of
> type Object, but not an actual object. Thus, rs is an empty (null)
> reference. In line 168, you attempt to use the null reference to qualify use
> of the EOF, which fails because rs does not point to an object.
>
> --
> Peter [MVP Visual Developer]
> Jack of all trades, master of none.


 
Reply With Quote
 
Peter van der Goes
Guest
Posts: n/a
 
      6th Aug 2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Peter, Thankx for your reply, i wanted to know that since i am
> just creating a reference and thus how do i fix it, am i supp to
> initialize a value or sthing, please let me know. thankyou


What is rs supposed to be? I could make a guess that you are trying to
create a recordset and that you are using ADO in your ASP application? The
..NET data access technology is ADO.NET, which does not use recordsets. When
you write:

Dim rs As Object

in VB.NET, you are creating a reference to an object of type Object (Object
being the class that sits at the top of the .NET Framework class hierarchy).
I could simply say that to create an actual object, you would just change
the statement to:

Dim rs as New Object

Then, rs would contain the address of the of the instance. However, that
answer masks the differences between the languages and between ASP and
ASP.NET, and will probably only get you to the "next error".
In VB.NET, as opposed to "classic" VB/VBA, you are dealing with a new,
object oriented programming language with rules that are quite different
from those for VB/VBA.

To convert your current ASP applications properly, you'll need to understand
the new world of .NET and how it differs from older technologies.

Here are several places you can start your research from:

http://msdn.microsoft.com/VBasic/Learning/Migrating/

http://msdn.microsoft.com/library/de...ualBasic60.asp

http://support.microsoft.com/default...b;en-us;317071

http://msdn.microsoft.com/library/de...hmap_vbnet.asp

http://msdn.microsoft.com/library/de...grationnet.asp

http://msdn.microsoft.com/library/de...asp?frame=true


--
Peter [MVP Visual Developer]
Jack of all trades, master of none.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CurrentDb.OpenRecordset error (error 91 - Object variable or With block variable not set) E. Kwong Microsoft Access 3 9th Sep 2008 10:08 PM
LateBinding.LateGet error : Object variable or With block variable not set. RJN Microsoft VB .NET 0 25th Feb 2005 06:18 PM
Run-time error '91': "Object variable or With block variable not set Mike Microsoft Excel Programming 2 30th Dec 2004 10:59 AM
Cells.Find > error Object variable or With block variable not set Peter Microsoft Excel Programming 2 8th May 2004 02:15 PM
Runtime Error 91: Object variable or width block variable not set BYang Windows XP Internet Explorer 1 4th May 2004 02:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:15 AM.