Unable to cast object of type 'System.DBNull' to type 'System.String'.

Server Error in '/' Application.

Unable to cast object of type 'System.DBNull' to type 'System.String'.

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: Unable to cast object of type 'System.DBNull' to type 'System.String'.

Source Error:


Line 263:        else if (SearchType == KEYWORD)
Line 264:        {
Line 265:            Walkingworld.CountyCollection _counties = Walkingworld.Lookups.GetAllRegions();
Line 266:            
Line 267:            Repeater_Walks_distance_county.DataSource = _counties;

Source File: d:\domains\walkingworld.com\httpdocs\CMSWebParts\Walkingworld\DisplayWalkList.ascx.cs    Line: 265

Stack Trace:


[InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.]
   WalkingworldLibrary.ListRegionsRow.get_regionText() +69

[StrongTypingException: The value for column 'regionText' in table 'ListRegions' is DBNull.]
   WalkingworldLibrary.ListRegionsRow.get_regionText() +124
   Walkingworld.Lookups.GetAllRegions() +173
   CMSWebParts_Walkingworld_DisplayWalkList.Page_Load(Object sender, EventArgs e) in d:\domains\walkingworld.com\httpdocs\CMSWebParts\Walkingworld\DisplayWalkList.ascx.cs:265
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   CMS.PortalControls.CMSAbstractWebPart.OnLoad(EventArgs e) +191
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.9179; ASP.NET Version:2.0.50727.9175