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 151:        //==========================
Line 152:
Line 153:        nooflead = UserDatabase.searchplayschools2(GridViewTop100Lead, 0, 1, setlanguage.returnCountryCode2(), startindex, pagesize, "lastmodifieddate", placeid, HiddenFieldState, HiddenFieldCity, HiddenFieldLocality, HiddenFieldPlaceExist);
Line 154:
Line 155:        //   Response.Write("nooflead=" + nooflead);

Source File: g:\pleskvhosts\playschoolworld.com\httpdocs\searchplayschools.aspx.cs    Line: 153

Stack Trace:


[InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.]
   UserDatabase.searchplayschools2(GridView GV, Byte programid, Int32 actionNo, String countrycode2, Int32 startIndex, Int32 pageSize, String sortBy, String placeid, HiddenField HiddenFieldState, HiddenField HiddenFieldCity, HiddenField HiddenFieldLocality, HiddenField HiddenFieldPlaceExist) +982
   searchplayschools.Page_Load(Object sender, EventArgs e) in g:\pleskvhosts\playschoolworld.com\httpdocs\searchplayschools.aspx.cs:153
   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
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


Version Information: Microsoft .NET Framework Version:2.0.50727.9061; ASP.NET Version:2.0.50727.9062