?? frmxjbab.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmxjbab
Caption = "新加坡安標"
ClientHeight = 4845
ClientLeft = 60
ClientTop = 345
ClientWidth = 7590
LinkTopic = "Form1"
ScaleHeight = 4845
ScaleWidth = 7590
StartUpPosition = 2 '屏幕中心
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frmxjbab.frx":0000
Height = 2535
Left = 630
TabIndex = 8
Top = 660
Width = 6405
_ExtentX = 11298
_ExtentY = 4471
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 1
BeginProperty Column00
DataField = "安標"
Caption = "安標"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1814.74
EndProperty
EndProperty
End
Begin VB.CommandButton cmdexit
Caption = "退出"
Height = 400
Left = 5670
TabIndex = 7
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmdsch
Caption = "查找"
Height = 400
Left = 4536
TabIndex = 6
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmddel
Caption = "刪除"
Height = 400
Left = 3404
TabIndex = 5
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmdmod
Caption = "修改"
Height = 400
Left = 2272
TabIndex = 4
Top = 4200
Width = 1000
End
Begin VB.CommandButton cmdadd
Caption = "添加"
Height = 400
Left = 1140
TabIndex = 3
Top = 4200
Width = 1000
End
Begin MSAdodcLib.Adodc Adodc1
Height = 345
Left = 5820
Top = 3450
Visible = 0 'False
Width = 1395
_ExtentX = 2461
_ExtentY = 609
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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.TextBox ab
DataField = "安標"
DataSource = "Adodc1"
Enabled = 0 'False
Height = 315
Left = 1950
TabIndex = 2
Text = "Text1"
Top = 3450
Width = 1575
End
Begin VB.Label Label2
Caption = "安標名稱:"
Height = 315
Left = 810
TabIndex = 1
Top = 3480
Width = 1125
End
Begin VB.Label Label1
Caption = "新加坡安標"
BeginProperty Font
Name = "宋體"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 3030
TabIndex = 0
Top = 120
Width = 1725
End
End
Attribute VB_Name = "frmxjbab"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsTemp As ADODB.Recordset
Private Sub cmdadd_Click()
On Error Resume Next
If cmdadd.Caption = "添加" Then
Adodc1.Recordset.AddNew
ab.Enabled = True
ab.SetFocus
cmdadd.Caption = "保存"
cmdmod.Caption = "取消"
Else
If Trim(ab.Text) = "" Then
MsgBox "安標名稱不能為空!", 0 + 16, "提示窗"
ab.SetFocus
Exit Sub
End If
Set rsTemp = New ADODB.Recordset '初始化數據庫
rsTemp.CursorType = adOpenKeyset
rsTemp.CursorLocation = adUseClient
rsTemp.LockType = adLockOptimistic
rsTemp.Open "select * from 新加坡安標 where 安標='" & Trim(ab.Text) & "'", cnSys
If rsTemp.RecordCount > 0 Then
MsgBox "該安標名稱的記錄已存在,請認真檢查!", 0 + 16, "提示窗"
cmdmod.Caption = "取消"
cmdadd.Caption = "添加"
Exit Sub
End If
Adodc1.Recordset.Update
Adodc1.Recordset.Requery '該語句非常重要,否則 Update 將出錯
ab.Enabled = False
cmdadd.Caption = "添加"
cmdmod.Caption = "修改"
End If
End Sub
Private Sub cmddel_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
If MsgBox("確定要刪除該記錄嗎?", 4 + 32, "刪除確認") = 6 Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.RecordCount > 0 Then Adodc1.Recordset.MoveLast
End If
Else
MsgBox "記錄已為空!", 0 + 64, "信息窗"
End If
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdmod_Click()
On Error Resume Next
If cmdmod.Caption = "修改" Then
ab.Enabled = True
varMark = Adodc1.Recordset.Bookmark '記下當前記錄的位置
cmdmod.Caption = "保存"
Exit Sub
End If
If cmdmod.Caption = "保存" Then
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
Adodc1.Recordset.Bookmark = varMark
ab.Enabled = False
cmdmod.Caption = "修改"
Exit Sub
End If
If cmdmod.Caption = "取消" Then
Adodc1.Recordset.Delete
cmdmod.Caption = "修改"
Exit Sub
End If
End Sub
Private Sub cmdsch_Click()
On Error Resume Next
tabname = "新加坡安標"
If cmdsch.Caption = "查找" Then
frmSearch.Show vbModal
If strQuery <> "" Then
Adodc1.RecordSource = strQuery
Adodc1.Refresh
cmdsch.Caption = "重置"
End If
Else
strQuery = "Select * From " & tabname
Adodc1.RecordSource = strQuery
Adodc1.Refresh
cmdsch.Caption = "查找"
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Adodc1.ConnectionString = strConn
Adodc1.RecordSource = "Select * From 新加坡安標"
Adodc1.Refresh
ab.Enabled = False
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -