selset.frm

来自「一个商业软件的源码」· FRM 代码 · 共 1,078 行 · 第 1/3 页

FRM
1,078
字号
Private Sub CurtButton3_Click()
Text1.Text = ""
kk = ""
End Sub



Private Sub CurtButton4_Click()
If CurtButton4.Caption = "编辑(&B)" Then
If Text1.Text <> "" Then
Text1.Text = ""
End If
CurtButton4.Caption = "运行(&R)"
Dim i, J As Integer
Call cx
If Text1.Text <> "" Then
If Combo3.Text <> "" Then
Text1.Text = Text1.Text & " order by " & Combo3.Text

End If



If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "对不起没有符合该条件的查询结果!"

kk = ""
Text1.Text = ""

Exit Sub
Else
sq = Adodc1.RecordSource
i = Len(Adodc1.RecordSource)
For J = 1 To i
If Mid(Adodc1.RecordSource, J, 4) = "from" Or Mid(Adodc1.RecordSource, J, 4) = "FROM" Then
wh = Mid(Adodc1.RecordSource, J)

End If
Next J

End If
End If

Else
CurtButton4.Caption = "编辑(&B)"
sq = Text1.Text

selectview.Show

End If
End Sub

Private Sub CurtButton5_Click()

Dim i, J As Integer
Call cx
If Text1.Text <> "" Then
If Combo3.Text <> "" Then
Text1.Text = Text1.Text & " order by " & Combo3.Text

End If
Adodc1.ConnectionString = cnnado.ConnectionString
Adodc1.RecordSource = Text1.Text
Adodc1.Refresh


If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "对不起没有符合该条件的查询结果!"

kk = ""
Text1.Text = ""

Exit Sub
Else
sq = Adodc1.RecordSource
i = Len(Adodc1.RecordSource)
For J = 1 To i
If Mid(Adodc1.RecordSource, J, 4) = "from" Or Mid(Adodc1.RecordSource, J, 4) = "FROM" Then
wh = Mid(Adodc1.RecordSource, J)

End If
Next J
Adodc1.ConnectionString = cnnado.ConnectionString
Adodc1.RecordSource = Text1.Text
selectview.Show
Adodc1.Refresh
End If
End If
kk = ""
Text1.Text = ""
Unload Me





End Sub



Private Sub CurtButton8_Click()
Unload Me
End Sub

Private Sub CurtButton9_Click()
Dim a As Integer
Dim i As Integer
List2.Clear
a = List1.ListCount - 1
For i = 0 To a
If List1.Selected(i) = True Then
List1.ListIndex = i
List2.AddItem List1.Text
End If
Next i
If List2.ListCount = 1 Then
'Combo3.Clear
'Combo3.AddItem "(" & "无" & ")"
List2.ListIndex = 0
'Combo3.AddItem List2.Text
Else
'Combo3.Clear
'Combo3.AddItem "(" & "无" & ")"
End If
End Sub

Private Sub DataCombo1_Click(Area As Integer)
If Combo1.Text = "" Or Combo1.Text = "(" & "无" & ")" Then
Else

 Adodc1.RecordSource = "select distinct " & Combo1.Text & " from " & TABA
 Adodc1.Refresh
Set DataCombo1.RowSource = Adodc1.Recordset
 DataCombo1.ListField = Combo1.Text
End If
If Combo2.Text <> "" And Combo1.Text <> "(" & "无" & ")" Or Combo1.Text <> "" And Combo2.Text <> "(" & "无" & ")" Then
CurtButton1.Enabled = True
CurtButton2.Enabled = True
Else
CurtButton1.Enabled = False
CurtButton2.Enabled = False
End If
End Sub



Private Sub Form_Load()

Combo2.AddItem "(" & "无" & ")"
Combo2.AddItem "="
Combo2.AddItem ">"
Combo2.AddItem "<"
Combo2.AddItem "<>"
Combo2.AddItem ">="
Combo2.AddItem "<="
Combo2.AddItem "Like"
Adodc1.ConnectionString = cnnado.ConnectionString
Adodc1.RecordSource = "select * from " & TABA
Adodc1.Refresh
Dim a As Integer
Dim i As Integer
Dim J As Integer
sql = Adodc1.RecordSource
a = Adodc1.Recordset.Fields.Count
Combo1.AddItem "(" & "无" & ")"
'Combo3.AddItem "(" & "无" & ")"
'Combo4.AddItem "(" & "无" & ")"
For i = 1 To a
Combo1.AddItem Adodc1.Recordset.Fields(i - 1).name
List1.AddItem Adodc1.Recordset.Fields(i - 1).name
Combo3.AddItem Adodc1.Recordset.Fields(i - 1).name

'Combo4.AddItem Adodc1.Recordset.Fields(i - 1).Name
Next i


End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call ReleaseCapture
      Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
Private Function ConvType(ByVal TypeVal As Long) As String
  Select Case TypeVal
        Case adBigInt                    ' 20
            ConvType = "Big Integer"
        Case adBinary                    ' 128
            ConvType = "Binary"
        Case adBoolean                   ' 11
            ConvType = "Boolean"
        Case adBSTR                      ' 8 i.e. null terminated string
            ConvType = "Text"
        Case adChar                      ' 129
            ConvType = "Text"
        Case adCurrency                  ' 6
            ConvType = "Currency"
        Case adDate                      ' 7
            ConvType = "Date/Time"
        Case adDBDate                    ' 133
            ConvType = "Date/Time"
        Case adDBTime                    ' 134
            ConvType = "Date/Time"
        Case adDBTimeStamp               ' 135
            ConvType = "Date/Time"
        Case adDecimal                   ' 14
            ConvType = "Float"
        Case adDouble                    ' 5
            ConvType = "Float"
        Case adEmpty                     ' 0
            ConvType = "Empty"
        Case adError                     ' 10
            ConvType = "Error"
        Case adGUID                      ' 72
            ConvType = "GUID"
        Case adIDispatch                 ' 9
            ConvType = "IDispatch"
        Case adInteger                   ' 3
            ConvType = "Integer"
        Case adIUnknown                  ' 13
            ConvType = "Unknown"
        Case adLongVarBinary             ' 205
            ConvType = "Binary"
        Case adLongVarChar               ' 201
            ConvType = "Text"
        Case adLongVarWChar              ' 203
            ConvType = "Text"
        Case adNumeric                  ' 131
            ConvType = "Long"
        Case adSingle                    ' 4
            ConvType = "Single"
        Case adSmallInt                  ' 2
            ConvType = "Small Integer"
        Case adTinyInt                   ' 16
            ConvType = "Tiny Integer"
        Case adUnsignedBigInt            ' 21
            ConvType = "Big Integer"
        Case adUnsignedInt               ' 19
            ConvType = "Integer"
        Case adUnsignedSmallInt          ' 18
            ConvType = "Small Integer"
        Case adUnsignedTinyInt           ' 17
            ConvType = "Timy Integer"
        Case adUserDefined               ' 132
            ConvType = "UserDefined"
        Case adVarNumeric                 ' 139
            ConvType = "Long"
        Case adVarBinary                 ' 204
            ConvType = "Binary"
        Case adVarChar                   ' 200
            ConvType = "Text"
        Case adVariant                   ' 12
            ConvType = "Variant"
        Case adVarWChar                  ' 202
            ConvType = "Text"
        Case adWChar                     ' 130
            ConvType = "Text"
        Case Else
            ConvType = "Unknown"
   End Select
End Function



Public Function cx()
Dim a As Integer
Dim i As Integer
Dim J As Integer
Dim ss As String
Dim jj As String

Dim aa As String
Dim bb As String
Dim CC As String
If List2.ListCount = 0 Then
a = List1.ListCount - 1

For i = 0 To a
List1.ListIndex = i
If i = a Then
ss = ss & List1.Text
Else
ss = ss & List1.Text & ","
End If

jj = "Select " & ss & " from " & TABA
Next i
Else
a = List2.ListCount - 1

For J = 0 To a
List2.ListIndex = J
If J = a Then
ss = ss & List2.Text
Else
ss = ss & List2.Text & ","
End If
Next J

jj = "Select " & ss & " from " & TABA
End If
'kk = "where " & "(" & "'" & form1.taba  &"'" & "." & Combo2.Text & Combo1.Text & " '" & DataCombo1.Text & "'" & ")"
'If Combo2.Text = "" Or Combo1.Text = "" Or Combo1.Text = "(" & "无" & ")" Then
'kk = ""
'Else
'End If


'If Combo3.Text = "" Or Combo3.Text = "(" & "无" & ")" Then
'aa = ""

'Else
'aa = " group by " & TABA & "." & Combo3.Text
'End If
'If Combo4.Text = "" Or Combo4.Text = "(" & "无" & ")" Then
'bb = ""

'Else
'bb = " order by " & TABA & "." & Combo4.Text
'End If
CC = jj & Text1.Text
Text1.Text = CC
End Function

Private Sub List1_DblClick()

List2.AddItem List1.Text

End Sub

Private Sub List2_Click()
UpDown1.Visible = True
End Sub

Private Sub UpDown1_DownClick()
Dim a As String
Dim b As Integer

b = List2.ListIndex
If b < List2.ListCount - 1 Then
a = List2.List(b + 1)
List2.List(b + 1) = List2.List(b)
List2.List(b) = a
List2.ListIndex = b + 1
End If
End Sub
Private Sub UpDown1_UpClick()
Dim c As String
Dim d As Integer

d = List2.ListIndex
If d > 0 Then
c = List2.List(d - 1)
List2.List(d - 1) = List2.List(d)
List2.List(d) = c
List2.ListIndex = d - 1
End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?