GridView中对绑定项进行删除和编辑的操作代码

删除的cs代码: protected void Page_Load(object sender, EventArgs e)
    {
        bind();
    }
    public void bind()
    {
        SqlConnection con = new SqlConnection(@"Data Source=PC-200903122150 \SQLEXPRESS;InitialCatalog=LoginTest;Integrated Security=True;Pooling=False");
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from Login", con);
        SqlDataReader sdr = cmd.ExecuteReader();
       
        GridView1.DataSource = sdr;
        GridView1.DataKeyNames = new string[] { "userName" };
        GridView1.DataBind();
       
    }
   
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=PC-200903122150\SQLEXPRESS;Initial Catalog=LoginTest;Integrated Security=True;Pooling=False");
        con.Open();
        string keys = GridView1.DataKeys[e.RowIndex].Value.ToString();;
        string sql = "delete  from Login where userName='" + keys + "'";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.ExecuteScalar();
        bind();
    }

 

编辑的cs代码:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           bind();
        }
       
    }
    public void bind()
    {
        SqlConnection con = new SqlConnection(@"Data Source=PC-200903122150\SQLEXPRESS;Initial Catalog=LoginTest;Integrated Security=True;Pooling=False");
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from Login", con);
        SqlDataReader sdr = cmd.ExecuteReader();

        GridView1.DataSource = sdr;
        GridView1.DataKeyNames = new string[] { "userName" };
        GridView1.DataBind();
        con.Close();

    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
       
        GridView1.EditIndex = e.NewEditIndex;//把GridView改为可编辑的状态
        bind();
    }
   
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;//取消编辑
         bind();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=PC-200903122150\SQLEXPRESS;Initial Catalog=LoginTest;Integrated Security=True;Pooling=False");
        con.Open();
        string keys = GridView1.DataKeys[e.RowIndex].Value.ToString();
        string userPwd = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString();
        string sql = "update Login set   userPwd='" + userPwd + "' where userName='"+keys+"'";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.ExecuteNonQuery();
        GridView1.EditIndex = -1;
        bind();
    }

 

源码和数据库奉上!!!

ENVI软件在遥感影像处理中扮演着至关重要的角色,其中影像的几何纠正功能对于确保影像数据的确性至关重要。几何纠正的过程涉及调整影像坐标,使其与实际地理坐标系统一致,这一步骤对于后续的分析和制图至关重要。 参考资源链接:[ENVI遥感影像处理全面指南:预处理、信息提取与三维可视化](https://wenku.youkuaiyun.com/doc/398pr5x5h3?spm=1055.2569.3001.10343) 具体步骤如下: 1. 打开ENVI软件,导入需要进行几何纠正遥感影像。 2. 选择相应的工具,例如“Basic Tools”菜单下的“Geometric Correction”选项。 3. 根据影像数据类型和需要达到的度,选择合适的纠正方法。ENVI提供了多种纠正算法,包括多项式模型、共线方程、地面控制点(GCP)校正等。 4. 如果使用GCP校正,需要在影像上选择若干地面控制点,并输入这些点的实际地理坐标,作为校正的基础。 5. 进行校正参数的计算,这个过程通常涉及到解算一个或多个多项式方程,以最小化影像中的点与真实地理坐标间的偏差。 6. 使用计算得到的参数进行影像的重新采样和配准,最终输出几何校正后的影像。 7. 校正结果需要评估,一般通过比较校正前后GCP的残差来验证校正度和效果。 适用场景: 几何纠正广泛应用于地形变化检测、土地利用调查、城市规划、环境监测等多个领域。在这些应用场景中,影像的几何准确性直接影响到分析结果的可靠性。 为了深入学习ENVI中遥感影像几何纠正的更多细节和高级应用,推荐参考《ENVI遥感影像处理全面指南:预处理、信息提取与三维可视化》一书。该指南不仅提供了理论知识,还详细介绍了操作步骤和实际应用案例,有助于读者全面掌握几何纠正的技巧和方法。 参考资源链接:[ENVI遥感影像处理全面指南:预处理、信息提取与三维可视化](https://wenku.youkuaiyun.com/doc/398pr5x5h3?spm=1055.2569.3001.10343)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值