未将对象引用设置到对象的实例
string userName = Session["name"].ToString();
DB.BLL.DBManager showsource = new DB.BLL.DBManager();
DataSet ds = new DataSet();
ds = showsource.ShowSource(userName);
if (ds != null)
{
GridView1.DataSource = ds;
}
不懂怎么解决
[解决办法]
Session["name"]为空
[解决办法]
判断Session["name"]为空就不走下去啦
[解决办法]
if(Session["name"] != null)
{
string userName = Session["name"].ToString();
DB.BLL.DBManager showsource = new DB.BLL.DBManager();
DataSet ds = new DataSet();
ds = showsource.ShowSource(userName);
if (ds != null)
{
GridView1.DataSource = ds;
}
}