平面广告公司管理系统内容摘要:

rname=39。 + () + 39。 and userpwd=39。 + () + 39。 and level=39。 + ())。 int count = (())。 if (count 0) { Session[username] =。 ()。 } else { (scriptalert(39。 用户名或者密码错误 ,请重新输入。 39。 )。 ()/script)。 return。 } ()。 ()。 } protected void Button2_Click(object sender, EventArgs e) { =。 =。 } } 各主要功能实现 员工信息添加 功能 实现 在 page_Load()事件中,对 DataGrid 控件的数据绑定 bind()方法进行调用,代码如下: protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) { ()。 }} Bind()方法的实现过程,通过连接数据库,使用存储过程取出用户表里面的信息,并在DataGrid 控件上显示。 代码如下: public SqlConnection GetConnection() { //连接到本地计算机的 yuwu 数据库 string myStr = Data Source=NIUGU。 Initial Catalog=yewu。 user id=sa。 pwd=123456。 Integrated Security=True。 SqlConnection myConn = new SqlConnection(myStr)。 return myConn。 20 } protected void bind() { SqlConnection myConn = GetConnection()。 ()。 string sqlStr = select * from [User]。 //创建 SqlDataAdapter 对象,调用 SQL 语句 SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConn)。 DataSet myDs = new DataSet()。 (myDs)。 = myDs。 ()。 ()。 ()。 ()。 } 当用户单击“添加”按钮后,触发添加事件,代码为: protected void btnAdd_Click(object sender, EventArgs e) { if ( != ) { SqlConnection myConn = GetConnection()。 ()。 // 往数据库插入信息 string sqlStr = insert into [User] ( username, userpwd ,realname,bianhao,bumen,zhiwei,sex,level ,phone,addtime, xueli)values(39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 ,39。 + () + 39。 )。 SqlCommand myCmd = new SqlCommand(sqlStr, myConn)。 ()。 ()。 //关闭连接 ()。 try { = 添加成功。 [color] = green。 } catch (SqlException error) { = 添加失败,请稍后再试: +。 [color] = red。 }} else 21 ()。 } 员工信息删除 功能实现 public partial class admin_deleteuser : { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ()。 } } public SqlConnection GetConnection() { SqlConnection myConn = new SqlConnection(Data Source=NIUGU。 Initial Catalog=yewu。 user id=sa。 pwd=123456。 Integrated Security=True)。 //数据连接代码 return myConn。 } //存储过程个取出信息,并显示 protected void bind() { SqlConnection myConn = GetConnection()。 ()。 string sqlStr = select * from [User]。 SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConn)。 DataSet myDs = new DataSet()。 (myDs)。 = myDs。 = new string[] { bianhao }。 ()。 ()。 ()。 ()。 } //删除数据 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int bianhao = ([].())。 string sqlStr = delete from [User] where bianhao= + bianhao。 SqlConnection myConn = GetConnection()。 ()。 SqlCommand myCmd = new SqlCommand(sqlStr, myConn)。 22 ()。 ()。 ()。 = 1。 ()。 } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if ( == ) { ((LinkButton)[0].Controls[0]).(onclick, return confirm(39。 确定要删除吗 ?39。 ))。 } } } 员工信息修改 功能实现 该代码这实现信息修改 protected void bind() { SqlConnection myConn = GetConnection()。 ()。 string sqlStr = select * from [User]。 SqlDataAdapter myDa = new SqlDataAdapter(sqlStr, myConn)。 DataSet myDs = new DataSet()。 (myDs)。 = myDs。 = new string[] { bianhao }。 ()。 ()。 ()。 ()。 } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { =。 ()。 } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int bianhao = ([].())。 string username = ((TextBox)([].Cells[0].Controls[1])).()。 23 string userpwd = ((TextBox)([].Cells[0].Controls[2])).()。 string realname = ((TextBox)([].Cells[0].Controls[3])).()。 string zhiwei = ((TextBox)([].Cells[0].Controls[4])).()。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。