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 42:         if (!IsPostBack)
Line 43:         {
Line 44:             con.Open();           
Line 45:             //string sqlorderno;
Line 46:             //int maxno;

Source File: e:\inetpub\vhosts\complimentsindia.com\madeinindia.net.in\products.aspx.cs    Line: 44

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider) +68
   MySql.Data.MySqlClient.Driver.LoadCharacterSets() +495
   MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection) +417
   MySql.Data.MySqlClient.NativeDriver.Configure(MySqlConnection conn) +16
   MySql.Data.MySqlClient.MySqlConnection.Open() +531
   products.Page_Load(Object sender, EventArgs e) in e:\inetpub\vhosts\complimentsindia.com\madeinindia.net.in\products.aspx.cs:44
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428


Version Information: Microsoft .NET Framework Version:2.0.50727.9061; ASP.NET Version:2.0.50727.9062