未将对象引用设置到对象的实例
SqlDataSource SqlDataSource1 = new SqlDataSource();
SqlDataSource1.ConnectionString = ConfigurationSettings.AppSettings["connStr"];
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
SqlDataSource1.SelectCommand = "CustResource";
SqlDataSource1.SelectParameters.Clear();
SqlDataSource1.SelectParameters.Add("@strName", System.TypeCode.String, sWhere.Trim());
DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
AspNetPager2.RecordCount = dv.Count;
string sort = (string)ViewState["SortOrder"] + " " + (string)ViewState["OrderDire"];
dv.Sort = sort;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dv;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager2.CurrentPageIndex - 1;
pds.PageSize = AspNetPager2.PageSize;
GridView1.DataSource = pds;
GridView1.DataBind();
加参数@strName就报错“未将对象引用设置到对象的实例”,不加参数就可以执行,是怎么回事啊,调试了一天都没有结果,
哪位大侠知道啊,在线等。。。。。。。。。。。。。。。