Easy Question

G

Guest

I have a ASP.NET web app that i'm developing and have come across something
that i can't get past. I have included the error message below.

How can i code the following line without getting the error shown below?

lblObject.Text = ds.Item(12)

Server Error in '/PriorityLaunches' Application
--------------------------------------------------------------------------------

Cast from type 'DBNull' to type 'String' is not valid.
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: Cast from type 'DBNull' to
type 'String' is not valid.

Source Error:


Line 86: lblSqFt.Text = ds.Item(12)
Line 87: lblFloorPlan.Text = ds.Item(13)
Line 88: lblComments.Text = ds.Item(14)
Line 89: lblMetroMarket.Text = ds.Item(6)
Line 90: lblSubMarket.Text = ds.Item(7)


Source File: C:\Inetpub\wwwroot\PriorityLaunches\PropertyDetails.aspx.vb
Line: 88

Stack Trace:


[InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.]
Microsoft.VisualBasic.CompilerServices.StringType.FromObject(Object Value)
PriorityLaunches.PropertyDetails.GetGeneral() in
C:\Inetpub\wwwroot\PriorityLaunches\PropertyDetails.aspx.vb:88
PriorityLaunches.PropertyDetails.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\PriorityLaunches\PropertyDetails.aspx.vb:49
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top