Server Error in '/' Application.

Data is Null. This method or property cannot be called on Null values.

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.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.

Source Error:


Line 75:             while (datareader.Read())
Line 76:             {
Line 77:                 struttura_id.Value = datareader.GetString(7).ToUpper();
Line 78:                 titolo = datareader.GetString(1).ToUpper();
Line 79:                 testo = datareader.GetString(2).Replace("&NBSP;", " ").Replace("&nbsp;", " ").Replace("<p class=\"testo\">&nbsp;</p>", "").Replace("<p class=\"testo\"><strong>&nbsp;</strong></p>", "");

Source File: e:\hosts\siti\weekendtoscana.it\offerta.aspx.cs    Line: 77

Stack Trace:


[SqlNullValueException: Data is Null. This method or property cannot be called on Null values.]
   MySql.Data.MySqlClient.MySqlDataReader.GetFieldValue(Int32 index, Boolean checkNull) +174
   MySql.Data.MySqlClient.MySqlDataReader.GetString(Int32 i) +36
   _offerta.get_offerte(String id) in e:\hosts\siti\weekendtoscana.it\offerta.aspx.cs:77
   _offerta.Page_Load(Object sender, EventArgs e) in e:\hosts\siti\weekendtoscana.it\offerta.aspx.cs:32
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4076.0