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 dbnull error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amitbadgi@gmail.com - 03 Aug 2005 09:45 GMT
Hi I am converting an asp to asp.net, i m getting this error in one of
the files,

Operator '=' is not defined for type 'DBNull' and string "Y".
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.InvalidCastException: Operator '=' is not
defined for type 'DBNull' and string "Y".

Source Error:

Line 259:<p>
<%=(rs_eventtype.Fields.Item("description").Value)%></p></td>
Line 260:                  <td align="center">
Line 261:                 <% if (rs_eventtype.Fields.Item("alwayson").Value) = "Y"
then %>
Line 262:                    <em>always on</em>
Line 263:                    <% else %>

Source File: C:\Documents and
Settings\amit\WebSite1\list_event_type.aspx    Line: 261

Stack Trace:

[InvalidCastException: Operator '=' is not defined for type 'DBNull'
and string "Y".]

Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(Object
Left, Object Right, Boolean TextCompare) +135
  ASP.list_event_type_aspx.__Render__control1(HtmlTextWriter __w,
Control parameterContainer) in C:\Documents and
Settings\amit\WebSite1\list_event_type.aspx:261
  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
msnews.microsoft.com - 03 Aug 2005 11:27 GMT
In the query that you are using to retrieve the data from the database, use
an ISNULL (or some other equivalent) to return 'N' (or some other value,
depending on your logic) for NULL values.

> Hi I am converting an asp to asp.net, i m getting this error in one of
> the files,
[quoted text clipped - 42 lines]
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
> +8878

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.