博客
关于我
gridview删除 asp.net
阅读量:138 次
发布时间:2019-02-27

本文共 925 字,大约阅读时间需要 3 分钟。

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e){// ???????// ??????????int rowIndex = e.RowIndex;// ????????GridViewRow row = GridView1.Rows[rowIndex];// ????????????string wjzh = row.Cells[1].Text;

// ??????// ????????????SQL????using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString())){    try    {        // ??????        SqlCommand sqlCommand = new SqlCommand("DELETE FROM QC_CSR WHERE wjzh = @wjzh", connection);        sqlCommand.Parameters.AddWithValue("@wjzh", wjzh);                // ????        connection.Open();        sqlCommand.ExecuteNonQuery();        connection.Close();    }    catch (Exception ex)    {        // ????        if (!IsDebugEnabled)        {            throw new Exception("???????" + ex.Message);        }        else        {            LogHelper.Log("????????" + ex.Message);        }    }}

}

转载地址:http://vofd.baihongyu.com/

你可能感兴趣的文章
Python中的分组/聚类数字
查看>>
python中的十六进制字符串到字节数组
查看>>
Python中的单元测试框架:使用unittest进行有效测试
查看>>
Python中的压缩和解压缩模块:zipfile和tarfile
查看>>
python中的变量可以随时命名、随时赋值_python基础2
查看>>
PYTHON中的可变和不可变字符串
查看>>
Python中的多个元组到两对元组?
查看>>
Python中的多态性
查看>>