这个问题郁闷我几天了....请大侠们..帮忙啊...为什么在绑定数据的时候出错啊.....
愿意的朋友可以QQ  或者MSN  远程帮我解决下....真的是苦 啊...
“/”应用程序中的服务器错误。
未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 行 184:            DataSet ds = new DataSet();
行 185:            ds = this._dsTemp;
行 186:           int count =Convert.ToInt32(ds.Tables[1].Rows[0][0]); 
行 187:            if (count > 0)
行 188:            {
源文件: C:\BDShop\YXShop.TemplateAction\DataSelect.cs    行: 186 堆栈跟踪: [NullReferenceException: 未将对象引用设置到对象的实例。]
   YXShop.TemplateAction.DataSelect.PageText(String _hrefStr) in C:\BDShop\YXShop.TemplateAction\DataSelect.cs:186
   YXShop.Web.Admin.Templates.Mo_TemplateContent_Manage.BindData(String _tp_Id, String _channelId, String _type, String _isDefault) in C:\BDShop\YXShop.Web\Admin\Templates\Mo_TemplateContent_Manage.aspx.cs:77
   YXShop.Web.Admin.Templates.Mo_TemplateContent_Manage.Page_Load(Object sender, EventArgs e) in C:\BDShop\YXShop.Web\Admin\Templates\Mo_TemplateContent_Manage.aspx.cs:45
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433

解决方案 »

  1.   

    是不是没有取到值呀
    调试跟踪下
    try
    {
       int count =Convert.ToInt32(ds.Tables[1].Rows[0][0]); 
    }catch下
      

  2.   

    行 186:          int count =Convert.ToInt32(ds.Tables[1].Rows[0][0]); 我记得是改成  int count =Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString()); 
      

  3.   

    在185行打个断点,debug下看ds.table[0]是否为空
      

  4.   

    出现这个错误说明ds.Tables[1].Rows[0][0]是空的或是null
    另外,你确认你的数据是在DataSet中的第二个数据表吗?
    如果你是直接填充的,应该在第一个数据表中也就是ds.Tables[0]表中.
      

  5.   

    ds.Tables[0].Rows[0][0] 
    这个表示的是ds中的第一个表的第一行的第一列。
      

  6.   

    多谢这么多朋友....我已经找到了...原来是在赋值的是很  转换错误   
       本来应该是varchar   结果一看是 intchar  所以就出错了...thanks  all