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

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 163:                    Response.Write("<input type=""hidden"" name=""i" & nIndex & """ value=""" & oRow("nMediaID") & """>" & vbNewLine)
Line 164:                    Response.Write("<input type=""hidden"" name=""n" & nIndex & """ value=""" & Server.HtmlEncode(Null2Empty(oRow("sMediaName"))) & """>" & vbNewLine)
Line 165:                    Response.Write("<input type=""hidden"" name=""m" & nIndex & """ value=""" & Server.HtmlEncode("http://vault01.hd.pics/" & RemoteFile(oRow("sOrigMediaKey"), oRow("sSizes"), oRow("sExtension"), nWidth, nHeight)) & """>" & vbNewLine)
Line 166:                    Response.Write("<input type=""hidden"" name=""t" & nIndex & """ value=""" & IIf(oRow("nMediaTypeID") = 9, "f", IIf(oRow("nStatusID") = 0, "h", "p")) & """>" & vbNewLine)
Line 167:                Next

Source File: c:\Web\HDPhotoHub\media\getzip.aspx    Line: 165

Stack Trace:


[InvalidCastException: Conversion from type 'DBNull' to type 'String' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value) +1307492
   ASP.media_getzip_aspx.Page_Load(Object Source, EventArgs E) in c:\Web\HDPhotoHub\media\getzip.aspx:165
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   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