Server Error in '/' Application.

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

Source Error:


Line 14:     id=httputility.htmlencode(request.querystring("idd"))
Line 15:     if id<1 then
Line 16:        id=ds.MyGetMaxID("sanat","id")
Line 17:     end if
Line 18:     DataList1.datasource = ds.MyGetDataSet1("sanat","id",id)

Source File: D:\wwwroot\adaycerceve\english\sanathaber.aspx    Line: 16

Stack Trace:


[InvalidCastException: Cast from type 'DBNull' to type 'Integer' is not valid.]
   Microsoft.VisualBasic.CompilerServices.IntegerType.FromObject(Object Value) +819
   fenikeli.adminclass.MyGetMaxID(String table, String id)
   ASP.sanathaber_aspx.Page_Load(Object sender, EventArgs e) in D:\wwwroot\adaycerceve\english\sanathaber.aspx:16
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +750


Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407