1、1. 考勤记录查询Imports SystemImports System.DataImports System.Data.SqlClientPartial Class addkaoqin Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As SqlConnection Dim constr As String constr = server = localhost
2、;database = user;uid=sa;pwd=430281199001125746 conn = New SqlConnection(constr) conn.Open() Dim sql As String = select * from user where ttime= + TextBox3.Text + Dim cmd As New SqlCommand(sql, conn) Dim dr As SqlDataReader = cmd.ExecuteReader() If dr.Read() = True Then Response.Write(时间不对!) Else Dim
3、 count As Integer dr.Dispose() Dim sql1 As String = insert into user(员工ID,名字,考勤时间,考勤类型) values ( & TextBox1.Text & , &TextBox1.Text & , & TextBox3.Text & , & TextBox4.Text & ) Dim cmd1 As New SqlCommand(sql1, conn) count = cmd1.ExecuteNonQuery() If count = 1 Then Response.Write(考勤记录添加成功!) Else Respo
4、nse.Write(考勤记录添加失败!) End If End If conn.Close() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click SqlDataSource1.SelectCommand = select *
5、from kaoqin where 员工ID= + TextBox1.Text + or 姓名= + TextBox1.Text + or 考勤时间= + TextBox3.Text + or 考勤类别= + TextBox4.Text + End Sub Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging GridView1
6、.PageIndex = e.NewPageIndex GridView1.DataBind() End SubEnd Class2. 工资管理界面代码Imports SystemImports System.DataImports System.Data.SqlClientPartial Class gongzi Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn A
7、s SqlConnection Dim constr As String constr = server = QT-05020917;database = user;uid=sa;pwd=430281199001125746 conn = New SqlConnection(constr) conn.Open() Dim sql As String = select * from gongzi where 姓?名?= + TextBox1.Text + Dim cmd As New SqlCommand(sql, conn) Dim dr As SqlDataReader = cmd.Exec
8、uteReader() If dr.Read() = True Then Response.Write(名字不对!) Else Dim count As Integer dr.Dispose() Dim sql1 As String = insert into user(姓?名?,性?别e,工资) values ( & TextBox1.Text & , &TextBox1.Text & , & TextBox3.Text & ) Dim cmd1 As New SqlCommand(sql1, conn) count = cmd1.ExecuteNonQuery() If count = 1
9、 Then Response.Write(工资添加成功!) Else Response.Write(工资添加失败!) End If End If conn.Close() End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click SqlDataSource1.SelectCommand = select * from gongzi where 姓名= + TextBox1.Text + End Sub Protected Sub G
10、ridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged End SubEnd Class3. 管理员模块代码Imports SystemImports System.DataImports System.Data.SqlClientPartial Class adduser Inherits System.Web.UI.Page Protected Sub TextBox2_TextChanged(ByVal
11、 sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If Session(TextBox1) = Then Response.Redirect(adduser.aspx) Else Dim conn As SqlConnection Dim constr As String
12、constr = server = localhost;database = Admin;uid=sa;pwd=430281199001125746 conn = New SqlConnection(constr) conn.Open() Dim sql As String = select * from user where tid= + TextBox1.Text + Dim cmd As New SqlCommand(sql, conn) Dim dr As SqlDataReader = cmd.ExecuteReader() If dr.Read() = True Then Resp
13、onse.Write(此顾客已经存在!) Else Dim count As Integer dr.Dispose() Dim sql1 As String = insert into user(员工ID,名字,性别,部门,联系电话) values ( & TextBox1.Text & , & TextBox2.Text & , & TextBox3.Text & , & TextBox4.Text & , & TextBox5.Text & ) Dim cmd1 As New SqlCommand(sql1, conn) count = cmd1.ExecuteNonQuery() If count = 1 Then Response.Write(顾客添加成功!) Else Response.Write(顾客添加失败!) End If End If conn.Close() End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End SubEnd Class
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100