我得到這個錯誤: 「grdViewPersonnel」這個名字不會在目前情況下存在「grdViewPersonnel」這個名字不會在目前情況下存在
public partial class frmViewPersonnel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// Declare the DataSet
dsPersonnel myDataSet = new dsPersonnel();
// Fill the dataset with what is returned from the function
myDataSet = clsDataLayer.GetPersonnel(Server.MapPath("PayrollSystem_DB.mdb"));
// Set the DataGrid to the DataSource based on the table
grdViewPersonnel.DataSource = myDataSet.Tables["tblPersonnel"];
// Bind the DataGrid
grdViewPersonnel.DataBind();
}
}
}
您的.aspx文件是否有一個名爲'grdViewPersonnel'的GridView對象? – drdwilcox
@drdwilcox:謝謝,我知道這很簡單。 – Mike