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

連鎖中心配送系統:連鎖店模塊的管理[3]

2022-06-13   來源: .NET編程 
    ——此文章摘自《ASPNET +SQL Server網絡應用系統開發案例精解》定價 特價 詳細>>http://tracklinktechcn/?m_id=dangdang&a_id=A&l=&l_type= width= height= border= nosave>

    STcmdParameters[@STDepID]Value=STmyGridDataKeys[(int)eItemItemIndex];
                       STcmdConnectionOpen();
                       //執行sql語句
                       STcmdExecuteNonQuery();
                       STmyGridEditItemIndex=;
             }
             catch(SqlException ex)
             {
                       throw ex;
             }
             STcmdConnectionClose();             
             BindGrid();      
    }

    ()響應取消事件
    //單擊取消按鈕所觸發的事件
    public void STmyGrid_cancel(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
    {
             //設置DataGrid控件中要編輯的項的索引為
             STmyGridEditItemIndex=;
             BindGrid();
    }

    ()響應刪除事件
    獲取管理員單擊的數據的索引並將其作為SQL刪除語句的條件執行語句重新顯示數據
    //單擊刪除按鈕所觸發的事件
    public void STmyGrid_delete(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
    {
             //創建刪除指定ID連鎖店的sql語句
             string STstrsql = delete from STDep where STDepID = @STDepID;
             //創建數據庫的SqlCommand對象
             SqlCommand STcmd = new SqlCommand(STstrsqlSTconn);
             //向SqlCommand對象添加參數
             STcmdParametersAdd(new SqlParameter(@STDepIDSqlDbTypeInt));
             //向參數賦值
             STcmdParameters[@STDepID]Value = STmyGridDataKeys[(int)eItemItemIndex];
             STcmdConnectionOpen();
             try
             {
                       //執行sql語句
                       STcmdExecuteNonQuery();
             }
             catch(SqlException)
             {
             }
             STcmdConnectionClose();                      
             BindGrid();
    }

right>[http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  []  [http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  


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