Server Error in '/webappointmentv18_4_7' 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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(MySqlConnection connection) +303
   MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection) +171
   MySql.Data.MySqlClient.MySqlConnection.Open() +660
   DataConnectionBase.DataConnection.TestConnection(String connectStr, String connectStrLow, DatabaseType dbtype, Boolean skipValidation) in C:\Dev\Ultimo18.4\UltimoDental18.4\DataConnectionBase\DataConnection.cs:555
   WebAppointment.Util.SetPatientDbConnection() in C:\Dev\Ultimo18.4\UltimoDental18.4Web\WebAppointment\Util.cs:20
   WebAppointment.Global.Application_Start(Object sender, EventArgs e) in C:\Dev\Ultimo18.4\UltimoDental18.4Web\WebAppointment\Global.asax.cs:8

[HttpException (0x80004005): Object cannot be cast from DBNull to other types.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10110183
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +123
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +181
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +228
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +314

[HttpException (0x80004005): Object cannot be cast from DBNull to other types.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10090424
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263


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