Option Explicit
Public flag As Integer
Public userID As String
Public userkind As Integer
Public ingid As Recordset
Public movieid As String
Global cn As ADODB.Connection
Global rs As ADODB.Recordset
Global sql As String
Global usernum As Integer
Option Explicit
Private query As String
Private Sub Command1_Click()
Call setSQL
Adodc1.RecordSource = query
If Not Option1.Value Then
MsgBox "没选择查询方式!"
Adodc1.Refresh
Set rsgrid.DataSource = Adodc1
End If
End Sub
Private Sub Command2_Click()
Dim query As String
query = "select*from (车位信息)"
Adodc1.RecordSource = query
If query <> "" Then
Option1.Value = False
Adodc1.Refresh
End If
Set rsgrid.DataSource = Adodc1
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
Call fresh
End Sub
Private Sub fresh()
Dim strquery, sql As String
strquery = "select * from 车位信息"
Adodc1.RecordSource = strquery
Adodc1.Refresh
Set rsgrid.DataSource = Adodc1
rsgrid.Refresh
Option1.Value = False
End Sub
Private Sub Text1_Change()
Option1.Value = True
Call setSQL
Adodc1.RecordSource = Trim(query)
Adodc1.CommandType = adCmdText
Adodc1.Refresh
Set rsgrid.DataSource = Adodc1
End Sub
Private Sub setSQL()
If Option1.Value Then
If Text1.Text <> "" Then
query = "select * from 车位信息 where left(cwtype," & Len(Text1.Text) & ")='" & Trim(Text1.Text) & "'"
Else
MsgBox "请输入你要查找的车位区域"
End If
End If
End Sub