📄 shitodriver_frm.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form shitodriver_frm
Caption = "查询市民对司机发表意见"
ClientHeight = 5670
ClientLeft = 5595
ClientTop = 3120
ClientWidth = 5835
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "shitodriver_frm.frx":0000
ScaleHeight = 5670
ScaleWidth = 5835
Begin VB.Frame Frame2
BackColor = &H00FFC0C0&
Caption = "删除"
Height = 1935
Left = 3720
TabIndex = 6
Top = 3480
Width = 1815
Begin VB.CommandButton Command1
Caption = "删 除"
Height = 375
Left = 240
TabIndex = 8
Top = 1200
Width = 1215
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 120
TabIndex = 7
Top = 480
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "选择姓名"
Height = 375
Left = 240
TabIndex = 9
Top = 240
Width = 1095
End
End
Begin MSAdodcLib.Adodc Ado
Height = 330
Left = 3360
Top = 3120
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "查询"
Height = 1935
Left = 1080
TabIndex = 1
Top = 3480
Width = 2295
Begin VB.CommandButton cmdexit
Caption = "退出查询"
Height = 375
Left = 360
TabIndex = 5
Top = 1440
Width = 1215
End
Begin VB.CommandButton cmdinquire
Caption = "查 询"
Height = 375
Left = 360
TabIndex = 4
Top = 960
Width = 1215
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 240
TabIndex = 2
Top = 480
Width = 1455
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "选择姓名"
Height = 495
Left = 360
TabIndex = 3
Top = 240
Width = 1215
End
End
Begin MSFlexGridLib.MSFlexGrid myFlexgrid
Height = 2415
Left = 1080
TabIndex = 0
Top = 840
Width = 4455
_ExtentX = 7858
_ExtentY = 4260
_Version = 393216
Rows = 3
Cols = 4
FixedRows = 0
BackColorBkg = 4194368
HighLight = 2
FillStyle = 1
AllowUserResizing= 1
End
End
Attribute VB_Name = "shitodriver_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdinquire_Click()
'看是否选择司机姓名
If Combo1.Text = "" Then
MsgBox "请你选择司机姓名!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
On Error Resume Next
Ado.Recordset.Close
Ado.Recordset.Open "select * from drivercomment_result where driver_name='" + Combo1.Text + " '"
'看所输入的车号是否存在
If Ado.Recordset.EOF Then
MsgBox "你所输入的司机姓名还没登记"
Else
'利用控件 MSFlexGrid来显示查询结果
With myFlexgrid
.Rows = 3
.CellAlignment = 2
.TextMatrix(1, 0) = "司机姓名"
.TextMatrix(1, 1) = "第一道结果"
.TextMatrix(1, 2) = "第二道结果"
.TextMatrix(1, 3) = "第三道结果"
Do While Not Ado.Recordset.EOF
.Rows = .Rows + 1
.CellAlignment = 2
'看记录集中该列的数据是否是空的
If IsNull(Ado.Recordset.Fields(0)) Then
.TextMatrix(.Rows - 1, 0) = ""
Else
.TextMatrix(.Rows - 1, 0) = Ado.Recordset.Fields(0)
End If
'看记录集中的数据是否是空的
If IsNull(Ado.Recordset.Fields(1)) Then
.TextMatrix(.Rows - 1, 1) = " "
Else
.TextMatrix(.Rows - 1, 1) = Ado.Recordset.Fields(1)
End If
'看记录集中的数据是否是空的
If IsNull(Ado.Recordset.Fields(2)) Then
.TextMatrix(.Rows - 1, 2) = ""
Else
.TextMatrix(.Rows - 1, 2) = Ado.Recordset.Fields(2)
End If
'看记录集中的数据是否是空的
If IsNull(Ado.Recordset.Fields(3)) Then
.TextMatrix(.Rows - 1, 3) = ""
Else
.TextMatrix(.Rows - 1, 3) = Ado.Recordset.Fields(3)
End If
'看记录集中的数据是否是空的
Ado.Recordset.MoveNext
Loop
End With
End If
End Sub
Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox "请你选择要删除的司机姓名!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
Ado.Recordset.Close
Ado.Recordset.Open "select * from drivercomment_result where driver_name= '" & (Combo1.Text) & " ' "
On Error Resume Next
Ado.Recordset.Delete
End Sub
Private Sub Form_Load()
Dim a As Integer
'采用ADO控件来连接数据库中的drivercomment_result中显示唯一的姓名
Ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb"
Ado.CommandType = adCmdText
Ado.RecordSource = "select distinct driver_name from drivercomment_result"
Ado.Refresh
For a = 0 To Ado.Recordset.RecordCount - 1
Combo1.AddItem Ado.Recordset.Fields(0)
Combo2.AddItem Ado.Recordset.Fields(0)
If Ado.Recordset.EOF = False Then
Ado.Recordset.MoveNext
End If
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -