?? demoform.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form DemoForm
Caption = "DemoForm"
ClientHeight = 3456
ClientLeft = 48
ClientTop = 336
ClientWidth = 5448
BeginProperty Font
Name = "宋體"
Size = 10.8
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 3456
ScaleWidth = 5448
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 324
Left = 1800
TabIndex = 9
Top = 240
Width = 2772
End
Begin VB.TextBox Text2
Height = 324
Left = 1800
TabIndex = 8
Top = 672
Width = 2772
End
Begin VB.CommandButton Command1
Caption = "&Next"
Height = 372
Left = 360
TabIndex = 7
Top = 1872
Width = 1092
End
Begin VB.CommandButton Command2
Caption = "&Previous"
Height = 372
Left = 1560
TabIndex = 6
Top = 1872
Width = 1092
End
Begin VB.CommandButton Command3
Caption = "&First"
Height = 372
Left = 2880
TabIndex = 5
Top = 1872
Width = 1092
End
Begin VB.CommandButton Command4
Caption = "&Last"
Height = 372
Left = 4080
TabIndex = 4
Top = 1872
Width = 1092
End
Begin VB.CommandButton Command5
Caption = "&Modify"
Height = 372
Left = 360
TabIndex = 3
Top = 2280
Width = 1452
End
Begin VB.CommandButton Command6
Caption = "&Update"
Height = 372
Left = 2040
TabIndex = 2
Top = 2280
Width = 1452
End
Begin VB.CommandButton Command7
Caption = "&Exit"
Height = 372
Left = 3720
TabIndex = 1
Top = 2280
Width = 1452
End
Begin VB.TextBox Text3
Height = 372
Left = 1800
TabIndex = 0
Top = 1152
Width = 2772
End
Begin MSAdodcLib.Adodc Test
Height = 312
Left = 1320
Top = 2832
Visible = 0 'False
Width = 2532
_ExtentX = 4466
_ExtentY = 550
ConnectMode = 3
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 2
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=PmData"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "PmData"
OtherAttributes = ""
UserName = "Admin"
Password = ""
RecordSource = "DataG"
Caption = "Test Ado Data"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 10.8
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "檔號"
Height = 216
Left = 720
TabIndex = 12
Top = 312
Width = 432
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "文件編號"
Height = 216
Left = 720
TabIndex = 11
Top = 792
Width = 864
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "FileType"
Height = 216
Left = 720
TabIndex = 10
Top = 1272
Width = 864
End
End
Attribute VB_Name = "DemoForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim adoCon As ADODB.Connection
Dim adoRst As ADODB.Recordset
Private Sub Command1_Click()
With adoRst
If Not .EOF Then
.MoveNext
If Not .EOF Then
Call LoadData
Else
.MoveLast
End If
End If
End With
End Sub
Private Sub Command2_Click()
With adoRst
If Not .BOF Then
.MovePrevious
If Not .BOF Then
Call LoadData
Else
.MoveFirst
End If
End If
End With
End Sub
Private Sub Command3_Click()
adoRst.MoveFirst
Call LoadData
End Sub
Private Sub Command4_Click()
adoRst.MoveLast
Call LoadData
End Sub
Private Sub Command5_Click()
Call SetEnable(True)
Text1.SetFocus
End Sub
Private Sub Command6_Click()
adoRst.Fields("檔號") = ConvertNull(Text1.Text)
adoRst.Fields("文件編號") = ConvertNull(Text2.Text)
adoRst.Fields("FileType") = ConvertNull(Text3.Text)
adoRst.Update
End Sub
Private Sub Command7_Click()
adoRst.Close
TestForm.Hide
Unload TestForm
End
End Sub
Private Sub Form_Load()
'Dim adoCon As ADODB.Connection
'Text1.Enabled = False
'Text2.Enabled = False
'Text3.Enabled = False
Set adoCon = New ADODB.Connection
adoCon.Open "PmData", "Admin"
Set adoRst = New ADODB.Recordset
Set adoRst.ActiveConnection = adoCon
adoRst.CursorType = adOpenDynamic
adoRst.LockType = adLockOptimistic
adoRst.Open "Select * From DataG Order By 檔號"
Call LoadData
End Sub
Private Sub LoadData()
Call SetEnable(False)
Text1.Text = adoRst!檔號
Text2.Text = adoRst!文件編號
Text3.Text = adoRst!FileType
End Sub
Private Sub SetEnable(T_F As Boolean)
Text1.Enabled = T_F
Text2.Enabled = T_F
Text3.Enabled = T_F
End Sub
Private Function ConvertNull(para_Value As Variant) As Variant
If IsNull(para_Value) = True Then
ConvertNull = ""
Else
ConvertNull = para_Value
End If
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -