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

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

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

                       //創建數據庫連接
                       STconn = new SqlConnection(STconnection);
             }
             else
             {
                       ResponseRedirect(/Indexaspx);
             }
    }
    private void STDe_add_Click(object sender SystemEventArgs e)
    {
             //創建插入產品信息的sql語句
             string STstrsql = insert into STProd(STProdName) values(@STProdName);
             //根據sql語句創建SqlCommand對象
             SqlCommand STcmd = new SqlCommand(STstrsqlSTconn);
             STcmdParametersAdd(new SqlParameter(@STProdNameSqlDbTypeVarChar));
             STcmdParameters[@STProdName]Value = STProdNameText ;
             STcmdConnectionOpen();
             try
             {
                       //執行sql語句
                       STcmdExecuteNonQuery();
                       //Label提示添加成功
                       STProd_warnText = 添加成功!;
                       //提示信息的字體顏色
                       STProd_warnStyle[color] = red;
                       ResponseRedirect(STManagerProductaspx);
             }
             catch(SqlException)
             {
                       //Label提示添加失敗
                       STProd_warnText = 添加失敗!;
                       STProd_warnStyle[color] = red;
                       ResponseRedirect(STManagerAddProductaspx);
             }
    }

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/15656.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.