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

連鎖中心配送系統:產品模塊的管理[2]

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

    ()響應編輯事件
    //單擊編輯按鈕所觸發的事件
    public void STmyGrid_edit(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
    {
             //獲取DataGrid所要編輯的項的索引
             STmyGridEditItemIndex=(int)eItemItemIndex;
             BindGrid();
    }

    ()響應更新事件
    //單擊更新按鈕所觸發的事件
    public void STmyGrid_update(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
    {
             //根據文本框信息創建更新用戶信息的sql語句
             string STstrsql=update STProd set STProdName = @STProdName where STProdID = @STProdID;
             //創建SqlCommand對象對sql語句進行操作
             SqlCommand STcmd=new SqlCommand(STstrsqlSTconn);
             try
             {
                       //向SqlCommand對象添加參數
                       STcmdParametersAdd(new SqlParameter(@STProdIDSqlDbTypeInt));
                       STcmdParametersAdd(new SqlParameter(@STProdNameSqlDbTypeVarChar));
                       string stupdatetext=((TextBox)eItemCells[]Controls[])Text;
                       //向參數賦值
                     STcmdParameters[@STProdName]Value=stupdatetext;      
    STcmdParameters[@STProdID]Value=STmyGridDataKeys[(int)eItemItemIndex];
                       STcmdConnectionOpen();    
                       //執行sql語句
                       STcmdExecuteNonQuery();
                       STmyGridEditItemIndex=;
             }
             catch(SqlException ex)
             {
                       throw ex;
             }
             STcmdConnectionClose();             
             BindGrid();
    }

    ()響應取消事件
    //單擊取消按鈕所觸發的事件
    public void STmyGrid_cancel(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
    {
             //獲取DataGrid所要編輯的項的索引為

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


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