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:

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) +60
   MySql.Data.MySqlClient.Driver.LoadCharacterSets(MySqlConnection connection) +484
   MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection) +170
   MySql.Data.MySqlClient.MySqlConnection.Open() +774
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +40

[EntityException: The underlying provider failed on Open.]
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +217
   System.Data.EntityClient.EntityConnection.Open() +129
   System.Data.Objects.ObjectContext.EnsureConnection() +85
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +49
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +41
   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +186
   System.Data.Entity.Internal.Linq.InternalSet`1.FindInStore(WrappedEntityKey key, String keyValuesParamName) +757
   System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +171
   CapaDatos.DAOs.servicios.traerUno(Int32 idServicio) in D:\Proyectos\WebSites\Transporte Junco\CapaDatos\DAOs\servicios.cs:41
   FrontEnd.mas_info.cargarServicio(Int32 idServicio) in D:\Proyectos\WebSites\Transporte Junco\FrontEnd\mas-info.aspx.cs:28
   FrontEnd.mas_info.Page_Load(Object sender, EventArgs e) in D:\Proyectos\WebSites\Transporte Junco\FrontEnd\mas-info.aspx.cs:20
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


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