BBS毕业论文(网络讨论平台) 联系客服

发布时间 : 星期五 文章BBS毕业论文(网络讨论平台)更新完毕开始阅读9bb7edf2eefdc8d377ee325c

网络讨论平台的设计与实现

}

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