当前位置:首页 > BBS毕业论文(网络讨论平台)
网络讨论平台的设计与实现
}
8、管理员账号修改
public partial class Admin_AddAdmin : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (Session[\== null) {
Response.Write(\language='javascript'>alert('您还没有登陆');location.h ref='login.aspx'\ } else { } }
protected void btnAdd_Click(object sender, EventArgs e) { try {
SqlConnection con = new SqlConnection(SqlHelper.connstring); con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = (SqlConnection)con;//对象实例化
cmd.CommandText = \into Admin (Apwd,Aname)values(@Apwd,@A name)\
cmd.Parameters.Add(\SqlDbType.VarChar); cmd.Parameters.Add(\SqlDbType.VarChar); cmd.Parameters[\= this.txtpwd.Text; cmd.Parameters[\= this.txtname.Text; cmd.ExecuteNonQuery(); con.Close();
Response.Write(\language='javascript'>alert('添加成功');location.href=' AdminList.aspx'\ } catch {
Response.Write(\language='javascript'>alert('添加失败');location.href=' AdminList.aspx'\ } } }
40
共分享92篇相关文档