Server Error in '/' Application.

Object cannot be cast from DBNull to other types.

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: Object cannot be cast from DBNull to other types.

Source Error:


Line 29:         if (!con.State.Equals(ConnectionState.Open))
Line 30:         {
Line 31:             con.Open();
Line 32:         }
Line 33:         cmd.CommandText = "SELECT count(distinct video_ID) FROM saeedah2_video where video_description like 'تقرير%' order by 1 desc limit 15;";

Source File: c:\inetpub\vhosts\alsaeedah.mochahosted.com\httpdocs\video_news_reports.aspx.cs    Line: 31

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider) +55
   System.Convert.ToInt32(Object value, IFormatProvider provider) +33
   MySql.Data.MySqlClient.Driver.LoadCharacterSets() +288
   MySql.Data.MySqlClient.Driver.Configure(MySqlConnection conn) +346
   MySql.Data.MySqlClient.NativeDriver.Configure(MySqlConnection connection) +10
   MySql.Data.MySqlClient.MySqlConnection.Open() +384
   video_other.build_video_list(String search) in c:\inetpub\vhosts\alsaeedah.mochahosted.com\httpdocs\video_news_reports.aspx.cs:31
   video_other.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\alsaeedah.mochahosted.com\httpdocs\video_news_reports.aspx.cs:158
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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