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;
}
}