“/”应用程序中的服务器错误。

无法将类型为“System.DBNull”的对象强制转换为类型“System.String”。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidCastException: 无法将类型为“System.DBNull”的对象强制转换为类型“System.String”。

源错误:


行 27:         int c = Convert.ToInt32(base.Request.QueryString["c"]);
行 28:         string str = this.common.GetCity(c);
行 29:         IList<Gyinfo> list = this.gyser.GetList("g_title like '%" + str + "%' and g_url!=''");
行 30:         this.AspNetPager.RecordCount = list.Count;
行 31:   

源文件: d:\www.ddgdd.com\list\listcity.aspx.cs    行: 29

堆栈跟踪:


[InvalidCastException: 无法将类型为“System.DBNull”的对象强制转换为类型“System.String”。]
   gsg.DAL.GyService.GetList(String value) +863
   list_listcity.Bind() in d:\www.ddgdd.com\list\listcity.aspx.cs:29
   list_listcity.Page_Load(Object sender, EventArgs e) in d:\www.ddgdd.com\list\listcity.aspx.cs:22
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2824


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3535.0