www.pudn.com > 数据库作业.rar > rhxx.frm
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form rhxx
BorderStyle = 1 'Fixed Single
Caption = "用户信息"
ClientHeight = 2055
ClientLeft = 45
ClientTop = 330
ClientWidth = 5085
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2055
ScaleWidth = 5085
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 615
Left = 3960
Top = 1800
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1085
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=医药信息管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=医药信息管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "用户"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "用户信息"
Height = 1815
Left = 120
TabIndex = 1
Top = 120
Width = 4815
Begin VB.CommandButton Comcancel
Caption = "取消"
Height = 375
Left = 3240
TabIndex = 12
Top = 1320
Width = 1215
End
Begin VB.CommandButton Comfirst
Caption = "|<<"
Height = 375
Left = 360
TabIndex = 11
Top = 840
Width = 615
End
Begin VB.CommandButton Compre
Caption = "<<"
Height = 375
Left = 960
TabIndex = 10
Top = 840
Width = 615
End
Begin VB.CommandButton Comnext
Caption = ">>"
Height = 375
Left = 1560
TabIndex = 9
Top = 840
Width = 615
End
Begin VB.CommandButton Comlast
Caption = ">>|"
Height = 375
Left = 2160
TabIndex = 8
Top = 840
Width = 615
End
Begin VB.CommandButton Comsave
Caption = "保存"
Height = 375
Left = 3240
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.CommandButton Comadd
Caption = "添加"
Height = 375
Left = 360
TabIndex = 6
Top = 1320
Width = 1215
End
Begin VB.CommandButton Comdel
Caption = "删除"
Height = 375
Left = 1560
TabIndex = 5
Top = 1320
Width = 1215
End
Begin VB.TextBox Text1
BackColor = &H80000009&
DataField = "账号"
DataSource = "Adodc1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 960
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1455
End
Begin VB.TextBox Text2
DataField = "密码"
DataSource = "Adodc1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
IMEMode = 3 'DISABLE
Left = 3120
TabIndex = 2
Text = "Text2"
Top = 240
Width = 1455
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 240
TabIndex = 4
Top = 360
Width = 615
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 2640
TabIndex = 3
Top = 360
Width = 495
End
End
End
Attribute VB_Name = "rhxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim b As Integer
Dim c As Integer
Private Sub Comadd_Click()
Comdel.Enabled = False
Comfirst.Enabled = False
Comnext.Enabled = False
Comlast.Enabled = False
Compre.Enabled = False
Comadd.Enabled = False
Comcancel.Enabled = True
b = Adodc1.Recordset.AbsolutePosition
c = Adodc1.Recordset.RecordCount + 1
Adodc1.Recordset.MoveLast
Adodc1.Recordset.AddNew
Adodc1.Recordset("账号") = "admin"
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comdel_Click()
Y = MsgBox("要删除该记录吗?", 36, "删除记录")
If Y = vbYes Then
If Adodc1.Recordset.AbsolutePosition < Adodc1.Recordset.RecordCount Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Else
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveLast
End If
End If
If Adodc1.Recordset.RecordCount = 1 Then
Comdel.Enabled = False
End If
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comfirst_Click()
Adodc1.Recordset.MoveFirst
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Compre_Click()
If Adodc1.Recordset.AbsolutePosition > 1 Then
Adodc1.Recordset.MovePrevious
Else
Adodc1.Recordset.MoveFirst
End If
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comnext_Click()
If Adodc1.Recordset.AbsolutePosition < Adodc1.Recordset.RecordCount Then
Adodc1.Recordset.MoveNext
Else
Adodc1.Recordset.MoveLast
End If
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comlast_Click()
Adodc1.Recordset.MoveLast
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comcancel_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.Move (b - c)
Comdel.Enabled = True
Comfirst.Enabled = True
Comnext.Enabled = True
Comlast.Enabled = True
Compre.Enabled = True
Comadd.Enabled = True
Comcancel.Enabled = False
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Comsave_Click()
If Text1.Text = "" Then
MsgBox ("请输入用户名!"), 16, ("错误")
ElseIf Text2.Text = "" Then
MsgBox ("请输入密码!"), 16, ("错误")
Else
Adodc1.Recordset.UpdateBatch
Comdel.Enabled = True
Comfirst.Enabled = True
Comnext.Enabled = True
Comlast.Enabled = True
Compre.Enabled = True
Comadd.Enabled = True
Comcancel.Enabled = False
End If
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub
Private Sub Form_Load()
Comcancel.Enabled = False
Frame1.Caption = "用户信息(" & Adodc1.Recordset.AbsolutePosition & ")"
End Sub