熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

用戶信息的查看、修改和刪除[5]

2022-06-13   來源: .NET編程 
    ——此文章摘自《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();
    }

[]  []  []  []  []  


From:http://tw.wingwit.com/Article/program/net/201311/15193.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.