ModifyInfo.aspx.cs Code

Source: Internet
Author: User

involves changing passwords, submitting request actions, and modifying database content
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingsystem.web;5 usingSystem.Web.UI;6 usingSystem.Web.UI.WebControls;7 usingSystem.Data.SqlClient;8 usingSystem.Data.Sql;9 usingSystem.Data;Ten  One  Public Partial classModifyInfo:System.Web.UI.Page A { -     protected voidPage_Load (Objectsender, EventArgs e) -     { the  -     } -     //Modify the interface, modify the change request -     protected voidFormview1_itemupdating (Objectsender, Formviewupdateeventargs e) +     { -E.cancel =true;//canceling a modification event to a system framework +         //get input information and compose SQL statements A         stringBGQQ = ((TextBox) Formview1.findcontrol ("Stdbgqqtextbox")). Text; at         stringStdxh = session["Stdxh"]. ToString (); -         stringsql ="update stdinfo Set [email protected] where [email protected]"; -sqlparameter[] param ={ -             NewSqlParameter ("@bgqq", Sqldbtype.text), -             NewSqlParameter ("@stdXh", SqlDbType.Char) -         }; inparam[0]. Value =bgqq; -param[1]. Value =Stdxh; to         //Execute SQL statement, modify database + sqlhelp.executenonequery (sqlhelp.connectionstringlcaltransaction, CommandType.Text, SQL, param); -         //Reload This page to refresh the data theResponse.Redirect ("modifyinfo.aspx?stdxh="+stdxh); *     } $     //Modify Password button handle eventPanax Notoginseng     protected voidLinkButton1_Click (Objectsender, EventArgs e) -     { the         //get the new and old password entered and the user name saved at login +         stringOldPassword = TxtOldPassword.Text.Replace ("'",""); A         stringNewPassword = TxtNewPassword.Text.Replace ("'",""); the         stringStdxh = session["Stdxh"]. ToString (); +         //querying the database to verify that the old password is correct -         stringsql = $             "Select COUNT (*) from stdinfo where [email protected] and [email protected]"; $SqlParameter []param={ -             NewSqlParameter ("@stdXh", Sqldbtype.text), -             NewSqlParameter ("@stdMm", Sqldbtype.text) the         }; -param[0]. Value=Stdxh;Wuyiparam[1]. Value=OldPassword; the         intUsercount= ((int) (Sqlhelp.executescalar (Sqlhelp.connectionstringlcaltransaction,commandtype.text,sql,param) )); -         if(usercount<=0)//if the query is not logged, it indicates an old password error Wu         { -Labmsg.text ="Old password Error"; About         } $         Else{ -             //perform a database operation to modify a password -             stringUpdatesql= -                 "update stdinfo Set [email protected] where [email protected]"; ASqlParameter []updateparam={ +                  NewSqlParameter ("@stdXh", Sqldbtype.text), the                  NewSqlParameter ("@stdMm", Sqldbtype.text) -             }; $param[0]. Value=Stdxh; theparam[1]. Value=NewPassword; the             if(Sqlhelp.executenonequery (Sqlhelp.connectionstringlcaltransaction,commandtype.text,updatesql,updateparam) >0) the             { thelabmsg.text="Modification succeeded"; -             } in             Else the             { thelabmsg.text="Modification Failed"; About             } the         } the     } the}

ModifyInfo.aspx.cs Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.