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

連鎖中心配送系統:用戶密碼的修改[2]

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

    <asp:comparevalidator id=Cv_pwd runat=server ControlToCompare=STNew_ pwd ControlToValidate=Tbx_pwdok
                                                   ErrorMessage=密碼不一致!></asp:comparevalidator></TD>
                                <TD>
                                         <asp:Button id=STUpdate_ok runat=server Text=修改></asp:Button>
                                         <asp:Label id=STUserPwd runat=server></asp:Label></TD>
                       </TR>
                       </TABLE>
             </TD>
    </TR>
    </TABLE>
    <uc:stfooter id=STFooter runat=server></uc:stfooter>

    .STUserUpdatePwdaspxcs的主要代碼及其解釋

    STUserUpdatePwdaspxcs主要實現了修改密碼的功能
    private void Page_Load(object sender SystemEventArgs e)
    {
             // 在此處放置用戶代碼以初始化頁面
             if(Session[STNickName] != null)
             {
                       //獲得數據庫連接字符串
                       string STconnection = ConfigurationSettingsAppSettings[strconnection];
                       STconn = new SqlConnection(STconnection);
                       //獲取登錄用戶的登錄名
                       STNickName = Session[STNickName]ToString();
                       STconnOpen();
                      //創建查詢登錄用戶密碼的sql語句
                       string STstrsql = select STUserPwd from STUser where STNickName = + STNickName + ;
                       //創建數據庫的SqlCommand對象
                       SqlCommand STcmd = new SqlCommand(STstrsqlSTconn);
                       //執行SqlCommand對象中數據的讀取
                       SqlDataReader STsdr = STcmdExecuteReader();
                       while(STsdrRead())
                       {
                                //將獲得的用戶名密碼保存到會話中
                                Session[STUserPwd] = STsdr[STUserPwd];

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


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