Server Error in '/' Application.

Conversion from type 'DBNull' to type 'String' is not valid.

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: Conversion from type 'DBNull' to type 'String' is not valid.

Source Error:


Line 733:        'cmd = _provider.command("SELECT max(qta) FROM magazzino WHERE idArticolo=" & id & " AND idlingua=" & Session("lingua"), _cn)
Line 734:        cmd = _provider.command("SELECT max(qta) FROM magazzino WHERE idArticolo=" & id, _cn)
Line 735:        value = cmd.ExecuteScalar
Line 736:        cmd.Dispose()
Line 737:        Return value

Source File: D:\home\sportingshop.net\httpdocs\App_Code\SPage.vb    Line: 735

Stack Trace:


[InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value) +1307492
   SPage.qtaMaxProdotto(Int32 id) in D:\home\sportingshop.net\httpdocs\App_Code\SPage.vb:735
   prodotto.schedaProdotto(DataRow dr) in D:\home\sportingshop.net\httpdocs\prodotto.aspx.vb:128
   prodotto.Page_Load(Object sender, EventArgs e) in D:\home\sportingshop.net\httpdocs\prodotto.aspx.vb:81
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   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