——此文章摘自《ASPNET +SQL Server网络应用系统开发案例精解》定价¥特价¥ 详细>> ()响应删除事件 //单击删除按钮所触发的事件 public void STmyGrid_delete(object source SystemWebUIWebControlsDataGridCommandEventArgs e) { //创建删除指定ID的sql语句 string STstrsql = delete from STUser where STUserID = @STUserID; //创建SqlCommand对象对sql语句进行操作 SqlCommand STcmd = new SqlCommand(STstrsqlSTconn); //添加参数 STcmdParametersAdd(new SqlParameter(@STUserIDSqlDbTypeInt)); STcmdParameters[@STUserID]Value = STmyGridDataKeys[(int)eItemItemIndex]; STcmdConnectionOpen(); try { //执行sql语句 STcmdExecuteNonQuery(); } catch(SqlException) { } STcmdConnectionClose(); BindGrid(); } [] [] [] [] [] |