📄 chaxun.frm
字号:
Top = 0
Width = 5535
_ExtentX = 9763
_ExtentY = 4048
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
AllowAddNew = -1 'True
AllowDelete = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 4
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
BeginProperty Column01
DataField = "频道"
Caption = "频道"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "节目"
Caption = "节目"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
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
EndProperty
BeginProperty Column01
EndProperty
BeginProperty Column02
EndProperty
BeginProperty Column03
EndProperty
EndProperty
End
Begin VB.Label Label5
Caption = "输入查询条件"
Height = 375
Left = 600
TabIndex = 15
Top = 4320
Width = 1215
End
Begin VB.Label Label4
Caption = "时长"
Height = 375
Left = 9960
TabIndex = 9
Top = 4320
Width = 615
End
Begin VB.Label Label3
Caption = "节目"
Height = 375
Left = 8520
TabIndex = 8
Top = 4320
Width = 615
End
Begin VB.Label Label2
Caption = "频道"
Height = 375
Left = 6960
TabIndex = 7
Top = 4320
Width = 495
End
Begin VB.Label Label1
Caption = "时间"
Height = 375
Left = 5280
TabIndex = 6
Top = 4320
Width = 495
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' 定义连接对象及记录集
Dim BitLenString As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
'全部查询按钮的单击事件过程
Dim strquery As String
'Dim myrs As New ADODB.Recordset
Set rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
strquery = "select * from 节目信息2"
rs.Open strquery, cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
End If
Text6.Text = rs.RecordCount
End Sub
Private Sub Command2_Click()
'单条查询按钮的单击事件
Dim strquery As String
Set rs.ActiveConnection = cn
'rs.CursorLocation = adUseClient
'rs.CursorType = adOpenForwardOnly
strquery = "select * from 节目信息2" + " where " + Text5.Text
rs.Open strquery
Text1.Text = rs.Fields("时间")
Text2.Text = rs.Fields("频道")
Text3.Text = rs.Fields("节目")
Text4.Text = rs.Fields("时长")
rs.Close
End Sub
Private Sub Command3_Click()
form2.Show
Form1.Hide
'Unload Me
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command5_Click()
'插入按钮的单击事件
Dim strquery As String
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
strquery = "select * from 节目信息2"
rs.Open strquery
rs.AddNew
rs.Fields("时间") = Text1.Text
rs.Fields("频道") = Text2.Text
rs.Fields("节目") = Text3.Text
rs.Fields("时长") = Text4.Text
rs.Update
rs.Close
End Sub
Private Sub Command6_Click()
'多条查询按钮的单击事件
Dim strquery As String
Set rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
strquery = "select * from 节目信息2 where" + Text5.Text
rs.Open strquery, cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
Set DataGrid2.DataSource = rs
DataGrid2.Refresh
End If
Text7.Text = rs.RecordCount
End Sub
Private Sub Command7_Click()
'删除过程
Dim strquery As String
Set rs.ActiveConnection = cn
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
strquery = "delete from 节目信息2 where 时间 =" + _
"'" + Text1.Text + "'" + "and 频道 =" + _
"'" + Text2.Text + "'" + "and 节目 = " + _
"'" + Text3.Text + "'" + " And 时长 =" + _
"'" + Text4.Text + "'"
rs.Open strquery
End Sub
Private Sub Command9_Click()
rs.Close
End Sub
Private Sub Form_Load()
cn.Provider = "sqloledb.1"
cn.Properties("Integrated Security").Value = "SSPI"
cn.Properties("initial catalog").Value = "shinning"
cn.Properties("Persist Security Info").Value = "False"
'Set cn = New ADODB.Connection
'Set rs = New ADODB.Recordset
cn.Open '打开连接
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -