请问一下,"因为它受保护级别限制,",是指什么意思,那该改什么文件或者该做什么呢
定义Public试试,具体没看到代码怎么样。。!
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
DataFiller();
}
}
private void DataFiller()
{
SqlConnection sqlcon=new SqlConnection("Data Source=localhost;uid=sa;pwd=admin;Initial Catalog=Northwind");
//SqlCommand sqlcom=new SqlCommand("select * from Products",sqlcon);
String strSQL="select ProductID,ProductName From Products Order By ProductID";
SqlDataAdapter sqldr=new SqlDataAdapter(strSQL,sqlcon);
DataSet ds=new DataSet();
sqldr.Fill(ds,"dtProducts");
dg.PagerStyle.NextPageText="Next";
dg.PagerStyle.PrevPageText="Previous";
dg.DataSource=ds.Tables["dtProducts"];
dg.DataBind();
//sqlcon.Open();
//dg.DataSource=sqlcom.ExecuteReader();
//dg.DataBind();
sqlcon.Close();
}
private void GridPageChange(object s,DataGridPageChangedEventArgs e)
{
dg.CurrentPageIndex=e.NewPageIndex;
DataFiller();
}
}
}