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

連鎖中心配送系統:用戶信息的添加[3]

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

                       //填充連鎖店列表框
                       STconnOpen ();
                       //創建查詢連鎖店信息的sql語句
                       string STmysql = select * from STDep;
                       SqlCommand STcmd =new SqlCommand(STmysqlSTconn);
                       SqlDataReader STdr = STcmdExecuteReader ();
                       //向連鎖店下拉列表框添加默認值
                       STDepNameItemsAdd(new ListItem() );
                       while(STdrRead ())
                       {
                                //向連鎖店下拉列表框添加連鎖店名字和ID
                                STDepNameItemsAdd(new ListItem(STdr[STDepName]ToString()STdr[STDepID]
ToString ()) );
                       }
                       //關閉連接
                       STconnClose ();
             }
             else
             {
                       ResponseRedirect(/Indexaspx);
             }
    }
    //單擊確定按鈕所觸發的事件
    private void ST_ok_Click(object sender SystemEventArgs e)
    {
             if(STNickNameText == )
             {
                       ST_WarnText = 用戶ID不能為空!;
                       ST_WarnStyle[color]=red;
             }
             else if(STUserNameText == )
             {
                       ST_WarnText = 用戶名字不能為空!;
                       ST_WarnStyle[color]=red;
             }
             else
             {
                       //創建SqlCommand對象采用存儲過程
                       SqlCommand STcmd =new SqlCommand(insert_STUser_STconn);
                       //獲取SqlCommand對象所調用的存儲過程名
                       STcmdCommandType=CommandTypeStoredProcedure;
                       STcmdParametersAdd(new SqlParameter(@STDepIDSqlDbTypeInt));
                       STcmdParametersAdd(new SqlParameter(@STNickNameSqlDbTypeVarChar));
                       STcmdParametersAdd(new SqlParameter(@STUserNameSqlDbTypeVarChar));
                       STcmdParametersAdd(new SqlParameter(@STUserPwdSqlDbTypeVarChar));

[]  []  []  []  


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