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

連鎖中心配送系統:產品信息維護[3]

2013-11-13 11:09:33  來源: .NET編程 
    ——此文章摘自《ASPNET +SQL Server網絡應用系統開發案例精解》定價 特價 詳細>>

             //單擊刪除所觸發的事件
             if(eCommandName==delete)
             {
                       //自定義delete()刪除指定ID的信息
                       delete();
             }
             BindGrid();
    }
    //加載delete()
    public void delete()
    {
             //獲取需要刪除的信息的id號
             string ID = Session[ID]ToString();
             //創建刪除指定id的產品信息的sql語句
             string STstrsql = delete from STProDe  where ID = @ID;
             //創建數據庫的SqlCommand對象
             SqlCommand STcmd = new SqlCommand(STstrsqlSTconn);
             //向SqlCommand對象添加參數
             STcmdParametersAdd(new SqlParameter(@IDSqlDbTypeInt));
             //給參數賦值
             STcmdParameters[@ID]Value = ID;
             STcmdConnectionOpen();
             try
             {
                       //執行sql語句
                       STcmdExecuteNonQuery();
             }
             catch(SqlException)
             {
             }
             STmysql = select STProDeIDSTProd* from STProDeSTProdSTDep where STProDeSTDepID = STDepSTDepID and STProDeSTProdID = STProdSTProdID;
             STcmdConnectionClose();                      
             ResponseRedirect(STUserProductaspx);
    }

[]  []  []  


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