Server Error in '/' Application.

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

Source Error:


Line 98:         If (reader.Read) Then
Line 99:             sFileName = reader("file_attachment").ToString
Line 100:            nChannelPermission = CInt(reader("channel_permission"))
Line 101:            sChannelName = reader("channel_name").ToString
Line 102:            

Source File: C:\inetpub\www\www.quadrix.org.br\wwwroot\systems\file_download.ashx    Line: 100

Stack Trace:


[InvalidCastException: Conversion from type 'DBNull' to type 'Integer' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value) +1312273
   FileDownload.ProcessRequest(HttpContext context) in C:\inetpub\www\www.quadrix.org.br\wwwroot\systems\file_download.ashx:100
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +195
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73


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