我写了这样一段,但是还是不行,不知道为什么,请大家帮我看看
namespace RCenterServiceAdmin
{
public class Admin : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label1;
    public string connStr="Provider=sqloledb;Data Source=(local);Initial Catalog=RSourceServiceAdmin;User Id=sa;Password=;";
public void grid_edit(Object sender, DataGridCommandEventArgs e)
{
if(!IsPostBack)
{
DataGrid1.EditItemIndex=e.Item.ItemIndex;
DataBind();
}
}
public void grid_cancel(Object sender, DataGridCommandEventArgs e)
{
//todo
DataGrid1.EditItemIndex=-1;
DataBind();
}
public void grid_update(Object sender, DataGridCommandEventArgs e)
{
if(!IsPostBack)
{
TextBox nodename=new TextBox(); 
e.Item.Cells[1].Controls[0].FindControl("nodename");
TextBox nodeIP=new TextBox();
e.Item.Cells[2].Controls[0].FindControl("nodeIP");
TextBox IsActive=new TextBox();
e.Item.Cells[3].Controls[0].FindControl("IsActive");
string strUpdate= "UPDATE Person SET 
                   nodename='"+nodename.Text+"',
                   nodeIP='"+nodeIP.Text+"',
                   IsActive='"+IsActive.Text+"'
                   WHERE ID='"+e.Item.Cells[0].Text+"'";
 OleDbConnection cn=new OleDbConnection(connStr);
 OleDbCommand com=new OleDbCommand(strUpdate, cn);
 cn.Open();
 com.ExecuteNonQuery();
 DataGrid1.EditItemIndex = -1;
 DataBind();
 cn.Close();
}
}
public void grid_delete(Object sender, DataGridCommandEventArgs e)
{
//todo
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
OleDbConnection cn=new OleDbConnection(connStr);
string sql="select * from NodeList";
DataSet ds=new DataSet();
OleDbDataAdapter da=new OleDbDataAdapter(sql,cn);
da.Fill(ds,"NodeList");
DataGrid1.DataSource=ds.Tables["NodeList"].DefaultView;
DataGrid1.DataBind();
}


} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load); }
#endregionprivate void RB_List_CheckedChanged(object sender, System.EventArgs e)
{

}
}
}