?? 數據庫操作.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form 數據庫操作
BackColor = &H8000000A&
Caption = "數據庫操作"
ClientHeight = 1995
ClientLeft = 60
ClientTop = 345
ClientWidth = 6165
LinkTopic = "Form1"
ScaleHeight = 1995
ScaleWidth = 6165
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "修 改"
Height = 315
Left = 3309
TabIndex = 20
Top = 1200
Width = 840
End
Begin VB.CommandButton Command4
Caption = "刪 除"
Height = 315
Left = 5100
TabIndex = 19
Top = 1200
Width = 840
End
Begin VB.CommandButton Command5
Caption = "首記錄"
Height = 315
Left = 30
TabIndex = 18
Top = 1650
Width = 1170
End
Begin VB.CommandButton Command3
Caption = "錄 入"
Height = 315
Left = 4204
TabIndex = 17
Top = 1200
Width = 840
End
Begin VB.TextBox Text6
Alignment = 1 'Right Justify
BackColor = &H80000001&
Enabled = 0 'False
Height = 285
Left = 1410
TabIndex = 15
Text = "Text6"
Top = 1200
Width = 855
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 4800
Top = 150
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
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 = ""
OLEDBString = ""
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.CommandButton Command9
Caption = "退 出"
Height = 315
Left = 4800
TabIndex = 14
Top = 1650
Width = 1170
End
Begin VB.CommandButton Command8
Caption = "末記錄"
Height = 315
Left = 3606
TabIndex = 13
Top = 1650
Width = 1170
End
Begin VB.CommandButton Command7
Caption = "下一記錄 >"
Height = 315
Left = 2414
TabIndex = 12
Top = 1650
Width = 1170
End
Begin VB.CommandButton Command6
Caption = "< 前一記錄"
Height = 315
Left = 1222
TabIndex = 11
Top = 1650
Width = 1170
End
Begin VB.CommandButton Command1
BackColor = &H80000009&
Caption = "查 詢"
Height = 315
Left = 2400
TabIndex = 10
Top = 1200
Width = 840
End
Begin VB.TextBox Text5
Alignment = 1 'Right Justify
DataField = "基本工資"
DataSource = "Adodc1"
Height = 270
Left = 4995
TabIndex = 9
Text = "Text5"
Top = 810
Width = 855
End
Begin VB.TextBox Text4
Alignment = 1 'Right Justify
DataField = "最后學歷"
DataSource = "Adodc1"
Height = 270
Left = 2700
TabIndex = 7
Text = "Text4"
Top = 810
Width = 1080
End
Begin VB.TextBox Text3
Alignment = 2 'Center
DataField = "性別"
DataSource = "Adodc1"
Height = 270
Left = 960
TabIndex = 6
Text = "Text3"
Top = 810
Width = 375
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
DataField = "出生日期"
DataSource = "Adodc1"
Height = 270
Left = 2880
TabIndex = 3
Text = "Text2"
Top = 195
Width = 1830
End
Begin VB.TextBox Text1
Alignment = 2 'Center
DataField = "姓名"
DataSource = "Adodc1"
Height = 285
Left = 930
TabIndex = 0
Text = "Text1"
Top = 210
Width = 810
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "請輸入姓名:"
Height = 180
Left = 240
TabIndex = 16
Top = 1260
Width = 1080
End
Begin VB.Label Label8
Caption = "性別:"
Height = 240
Left = 240
TabIndex = 8
Top = 840
Width = 570
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "基本工資:"
Height = 180
Left = 4005
TabIndex = 5
Top = 840
Width = 900
End
Begin VB.Label Label6
Caption = "最后學歷:"
Height = 285
Left = 1785
TabIndex = 4
Top = 840
Width = 960
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "出生日期:"
Height = 180
Left = 1980
TabIndex = 2
Top = 240
Width = 900
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 255
Left = 240
TabIndex = 1
Top = 240
Width = 600
End
End
Attribute VB_Name = "數據庫操作"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Falg As Integer
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;" & _
"Extended Properties=DSN=職工情況;APP=Visual Basic;WSID=YAO_WEI_SERVER;" & _
"DATABASE=職工情況;Trusted_Connection=Yes"
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "表1"
Adodc1.Refresh
End Sub
Private Sub Command1_Click()
Text6.BackColor = &H80000005
Text6.Enabled = True
Text6.SetFocus
Falg = 1: CmdUnEnabled
End Sub
Private Sub Command2_Click()
Text6.BackColor = &H80000001
Falg = 0: CmdEnabled
TxtUnLock
End Sub
Private Sub Command3_Click()
On Error Resume Next
Text6.BackColor = &H80000001
Falg = 0: CmdEnabled
TxtUnLock
Adodc1.Recordset.AddNew
Text1.SetFocus
End Sub
Private Sub Command4_Click()
On Error Resume Next
Text6.BackColor = &H80000001
Falg = 0: CmdEnabled
Adodc1.Recordset.Delete
Adodc1.Refresh
End Sub
Private Sub Command5_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub Command6_Click()
If Falg = 1 Then
Adodc1.Recordset.MovePrevious
Adodc1.RecordSource = "Select * from 表1 Where [姓名] Like" + "'" + Text6 + "%" + "'"
If Text1 = "" Then
MsgBox " 記錄查詢完畢 ! ", vbExclamation
Exit Sub
End If
Else
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.AbsolutePosition = adPosBOF Then
Adodc1.Recordset.MoveFirst
MsgBox " 已經是第一條記錄 ! ", vbExclamation, "提示信息"
End If
End If
End Sub
Private Sub Command7_Click()
If Falg = 1 Then
Adodc1.Recordset.MoveNext
Adodc1.RecordSource = "Select * from 表1 Where [姓名] Like" + "'" + Text6 + "%" + "'"
If Text1 = "" Then
MsgBox " 記錄查詢完畢 ! ", vbExclamation
Exit Sub
End If
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.AbsolutePosition = adPosEOF Then
Adodc1.Recordset.MoveLast
MsgBox " 已經是最后一條記錄 ! ", vbExclamation, "提示信息"
End If
End If
End Sub
Private Sub Command8_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub Command9_Click()
On Error Resume Next
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Unload Me
End
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Adodc1.RecordSource = "Select * from 表1 Where [姓名] Like" + "'" + Text6 + "%" + "'"
Adodc1.Refresh
End If
End Sub
Private Sub CmdUnEnabled()
Command5.Enabled = False: Command8.Enabled = False
End Sub
Private Sub CmdEnabled()
Command5.Enabled = True: Command8.Enabled = True
End Sub
Private Sub TxtLock()
Text1.Locked = True: Text2.Locked = True: Text3.Locked = True: Text4.Locked = True: Text5.Locked = True
End Sub
Private Sub TxtUnLock()
Text1.Locked = False: Text2.Locked = False: Text3.Locked = False: Text4.Locked = False: Text5.Locked = False
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -