4. 学生宿舍基本信息表映射为Access2003中的ssxxb即:
5. 将属性、方法映射到编程环境中 1) 管理员登录的界面为
2) 管理员登录的代码为: Public Class Form1
Public DBconn As String = \Source=|DataDirectory|\\xssssjk.mdb\ Public num As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim response As MsgBoxResult
response = MsgBox(\确实要退出登录吗?\, vbOKCancel + vbQuestion, \系统提示!\)
If response = MsgBoxResult.Ok Then End End If End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New OleDb.OleDbConnection Dim comm As New OleDb.OleDbCommand
Dim da As New OleDb.OleDbDataAdapter Dim ds As New DataSet Dim tb As New DataTable ds.Tables.Add(tb)
conn.ConnectionString = DBconn
comm.CommandText = \ &
Trim(Me.ComboBox2.Text) & \ & Trim(Me.TextBox1.Text) & \jb='\ & Trim(Me.ComboBox1.Text) & \ comm.Connection = conn da.SelectCommand = comm conn.Open()
da.Fill(ds, \) conn.Close()
If ds.Tables(\).Rows.Count = 0 Then num = num + 1 If num < 3 Then
MsgBox(\没有这个用户,你已经登录\ & num & \次。请继续登录!\, vbOKOnly + vbExclamation, \信息提示!!\) Me.TextBox1.Text = \ Else
MsgBox(\你已经登录失败三次,退出系统!\, vbOKOnly + vbExclamation, \信息提示!!\) End End If Else
If Trim(Me.ComboBox1.Text) = \系统管理员\ Then Me.Hide()
zhujiem.Show() Else
Me.Hide()
zhujiem.Show()
My.Forms.zhujiem.系统管理员ToolStripMenuItem.Enabled = False
End If End If End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load num = 0
Dim conn As New OleDb.OleDbConnection Dim comm As New OleDb.OleDbCommand Dim da As New OleDb.OleDbDataAdapter Dim ds As New DataSet
Dim tb As New DataTable ds.Tables.Add(tb)
conn.ConnectionString = DBconn
comm.CommandText = \ comm.Connection = conn da.SelectCommand = comm conn.Open()
da.Fill(ds, \) conn.Close()
Me.ComboBox1.DataSource = ds.Tables(\) Me.ComboBox1.ValueMember = \
Me.ComboBox2.DataSource = ds.Tables(\) Me.ComboBox2.ValueMember = \ End Sub
End Class
3) 晚归管理的界面为:
4) 晚归管理的代码为: Public Class wggl
Dim objds As New DataSet
Dim objXSTable As New DataTable
Dim objDa As New OleDb.OleDbDataAdapter Dim wherestr As String Public Sub refreshdata()
objDa.Update(objds, \) objXSTable.Clear()
bindgridview(wherestr) End Sub
Public Sub bindgridview(ByVal strXH As String) Dim objConn As New OleDb.OleDbConnection Dim objComm As New OleDb.OleDbCommand 'Dim wherestr As String
objConn.ConnectionString = My.Forms.Form1.DBconn
objComm.CommandText = \学号,姓名,宿舍号,专业名,晚归时间,晚归原因from wgb \
If Trim(strXH) <> \ Then
objComm.CommandText = objComm.CommandText & strXH End If
objComm.Connection = objConn