Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

asp to asp.net with block variable not set error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amitbadgi@gmail.com - 04 Aug 2005 01:04 GMT
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
Peter van der Goes - 04 Aug 2005 14:17 GMT
>I am getting this error for a file while converting an asp application
> to asp.net
[quoted text clipped - 16 lines]
> 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.

Signature

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

amitbadgi@gmail.com - 05 Aug 2005 22:38 GMT
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
> >I am getting this error for a file while converting an asp application
> > to asp.net
[quoted text clipped - 25 lines]
> Peter [MVP Visual Developer]
> Jack of all trades, master of none.
Peter van der Goes - 06 Aug 2005 15:06 GMT
> 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/default.asp?url=/library/en-us/vbcon/html/vbor
iUpgradingFromVisualBasic60.asp


http://support.microsoft.com/default.aspx?scid=kb;en-us;317071

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/t
echmap_vbnet.asp


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmscms02/html/
cms_2002migrationnet.asp


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/asp
netmigrissues.asp?frame=true


Signature

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


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.