?? roomtype.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 FMRoomType
Caption = "房間類型:"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 345
ClientWidth = 6405
LinkTopic = "Form1"
ScaleHeight = 5340
ScaleWidth = 6405
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdCancel
Caption = "刪除"
Height = 495
Left = 4920
TabIndex = 7
Top = 960
Width = 1215
End
Begin VB.TextBox TextRTN
Height = 375
Left = 2280
TabIndex = 6
Top = 1080
Width = 1815
End
Begin VB.TextBox TextRTID
Height = 375
Left = 2280
TabIndex = 5
Top = 240
Width = 1815
End
Begin VB.CommandButton CmdAdd
Caption = "添加"
Height = 495
Left = 4920
TabIndex = 2
Top = 240
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 450
Left = 4200
Top = 2160
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 794
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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=test;Data Source=ZHANG"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=test;Data Source=ZHANG"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "RoomType"
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 MSDataGridLib.DataGrid DataGrid1
Bindings = "RoomType.frx":0000
Height = 3135
Left = 240
TabIndex = 0
Top = 2040
Width = 5925
_ExtentX = 10451
_ExtentY = 5530
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
ColumnHeaders = -1 'True
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.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = "RoomTypeID"
Caption = "房間類型編號"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "RoomTypeName"
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
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = " 房間類型"
Height = 3495
Left = 120
TabIndex = 1
Top = 1800
Width = 6135
End
Begin VB.Label Label2
Caption = "房間類型名稱:"
Height = 375
Left = 480
TabIndex = 4
Top = 1080
Width = 1455
End
Begin VB.Label Label1
Caption = "房間類型編號:"
Height = 255
Left = 480
TabIndex = 3
Top = 360
Width = 1335
End
End
Attribute VB_Name = "FMRoomType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdAdd_Click()
Dim AddRoomType As New ADODB.Recordset
Dim SqlStr As String
Dim DBStrID As String
Dim DBStrName As String
Dim sRoomTypeID As String
Dim sRoomTypeName As String
If Me.TextRTID.Text = "" Then
MsgBox "請輸入房間類型編號!"
Exit Sub
End If
sRoomTypeID = Trim(Me.TextRTID.Text)
If Me.TextRTN.Text = "" Then
MsgBox "請輸入房間類型名稱!"
Exit Sub
End If
sRoomTypeName = Trim(Me.TextRTN.Text)
DBStrID = "select * from RoomType where RoomTypeID='" & sRoomTypeID & "'"
AddRoomType.Open DBStrID, DBCnn, adOpenForwardOnly, adLockOptimistic
If Not AddRoomType.BOF Then
MsgBox "該房間類型編號已存在!"
AddRoomType.Close
Exit Sub
End If
AddRoomType.Close
DBStrName = "select * from RoomType where RoomTypeName='" & sRoomTypeName & "'"
AddRoomType.Open DBStrName, DBCnn, adOpenForwardOnly, adLockOptimistic
If Not AddRoomType.BOF Then
MsgBox "該房間類型名稱已存在!"
AddRoomType.Close
Exit Sub
End If
AddRoomType.Close
SqlStr = "insert into RoomType(RoomTypeID,RoomTypeName) values('" & sRoomTypeID & "','" & sRoomTypeName & "');"
DBCnn.Execute SqlStr
'MsgBox "添加成功!"
Me.TextRTID.Text = ""
Me.TextRTN.Text = ""
Adodc1.Refresh
End Sub
Private Sub CmdCancel_Click()
If Me.DataGrid1.Row = 0 Then
MsgBox "沒有選擇!"
Exit Sub
End If
Me.Adodc1.Recordset.Delete
MsgBox "刪除成功!"
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2 '垂直方向居中
Me.Left = (Screen.Width - Me.Height) / 2 '水平方向居中
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -