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 21:         MySqlDataAdapter adp = new MySqlDataAdapter("select * from tbplylst", ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
Line 22:         DataSet ds = new DataSet();
Line 23:         adp.Fill(ds);
Line 24:         Repeater3.DataSource = ds;
Line 25:         Repeater3.DataBind();

Source File: c:\inetpub\vhosts\bookraja.com\missioncat.in\PublicMasterPage.master.cs    Line: 23

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() +523
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +182
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +180
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +126
   PublicMasterPage.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\bookraja.com\missioncat.in\PublicMasterPage.master.cs:23
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Control.LoadRecursive() +185
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


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