用户代码未处理NullReferenceException: 未将对象引用设置到对象的实例
代码如下:
DateTime selDate = (DateTime)DatePicker1.SelectedDate;
DataSet ds = new DataSet();
//ds = bllcount.GetList(" CT_ISOK=1 and CT_ISMS=0");
ds = bllcount.GetList(" CT_ISOK=1 and CT_ISMS=0", selDate);
if (ds.Tables.Count > 0)
{
Grid1.DataSource = ds.Tables[0];
Grid1.DataBind();
}
每次把数据集绑定到grid的时候就会出错。
堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
ExtAspNet.WindowField.GetColumnValue(GridRow row) +1021
ExtAspNet.GridRow.DataBindRow() +275
ExtAspNet.Grid.DataBindRow(Int32 rowIndex, Object rowObj) +172
ExtAspNet.Grid.DataBindToDataTable(DataTable dataTable) +131
ExtAspNet.Grid.DataBind() +403
WebFrameWork.webPage.TJpage.SSFY.BindGridData() in G:\供热收费\20120618\HRSF\WebFrameWork\webPage\TJpage\SSFY.aspx.cs:43
WebFrameWork.webPage.TJpage.SSFY.Page_Load(Object sender, EventArgs e) in G:\供热收费\20120618\HRSF\WebFrameWork\webPage\TJpage\SSFY.aspx.cs:29
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
网上看到很多类似的情况,可是都不太一样,请高手指教~~~~(>_<)~~~~