急,未将对象引用设置到对象的实例?? BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString()))未将对象引用设置到对象的实例。什么原因啊??望指教~~是不是要用三元判断符判断下啊?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 冒泡Session["System.RoleId"]为null? if(Session["System.RoleId"] != null) //需要做这个判断{ BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString()))} Session["System.RoleId"].ToString()值为null你加个判断就行了if(! String.IsNullOrEmpty(Session["System.RoleId"].ToString())){ BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString())) } BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))为什么不行啊?? 用:if(Session["System.RoleId"] != null) { BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString()))} 如果Session["System.RoleId"]为null,那么就不执行BindEmergGridData();如果用:BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))可能会这么执行:BindEmergGridData(""); 但我就要他一开始的时候执行BindEmergGridData("");BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))有错??望指出错误在哪里啊?? Session["System.RoleId"] 为NULL吧! BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))报的错误是无法确定条件表达式的类型,string和int 之间没有隐式转换~~ 请教WinCE下TreeView的问题 ASP.NET2.0 网站问题 新手上路,请教c#中读写txt文件的问题 cs文件如何运行 问一个C#中函数方法调用的问题 好基础的问题,大家快来帮忙啊!!急啊!! 面向对象设计经验原则61点讨论续 之 21-30 请教高手!能在WEB页面上插入office对象吗?急!!! 重新开贴!!!如何用DATASET来更新、添加、删除数据呢?放分!!! 请问在.net集成环境下编译好的程序怎么生成为可执行文件,生成以后还需要.net环境吗? 这有一句C#程序,在VS中运行总是提示有错,大家帮我看看怎么改才行啊 线程难点
{
BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString()))
}
你加个判断就行了
if(! String.IsNullOrEmpty(Session["System.RoleId"].ToString()))
{
BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString())) }
if(Session["System.RoleId"] != null)
{
BindEmergGridData(Convert.ToInt32(Session["System.RoleId"].ToString()))
}
如果Session["System.RoleId"]为null,那么就不执行BindEmergGridData();
如果用:
BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))
可能会这么执行:
BindEmergGridData("");
BindEmergGridData(Session["System.RoleId"]==null?"":Convert.ToInt32(Sessio["System.RoleId"].ToString()))有错??望指出错误在哪里啊??