protected void orgUpdate(object sender,DataGridCommandEventArgs e)
    {
        string strorgid = e.Item.Cells[0].Text.Trim();
        string strName = ((TextBox)e.Item.Cells[4].Controls[1]).Text.Trim();
        string strType = ((TextBox)e.Item.Cells[5].Controls[1]).Text.Trim();
        string strDesc = ((TextBox)e.Item.Cells[6].Controls[1]).Text.Trim();        string strSQL = "UPDATE Organization SET orgname='" + strName.Replace("'", "''") + "',orgtype='" + strType.Replace("'", "''") + "',orgdesc='" + strDesc.Replace("'", "''") + "'where orgid='" + strorgid + "'";
        string strConn = "server=localhost;uid=sa;pwd=;database=HR";
        SqlConnection connUpdate = new SqlConnection(strConn);
        SqlCommand sqlCommandUpdate = new SqlCommand(strSQL, connUpdate);
        sqlCommandUpdate.Connection.Open();
        sqlCommandUpdate.ExecuteNonQuery();
        displayMain.EditItemIndex = -1;
        sqlCommandUpdate.Connection.Close();
        displayMain.EditItemIndex = -1;
        displayMain.DataSource = CreateDataView();
        displayMain.DataBind();
    }请问这样写哪里有问题了?我更新不了数据库!