zlqueryForm.frm
资源名称:七八个vb游戏.rar [点击查看]
上传用户:tashmp
上传日期:2010-04-03
资源大小:882k
文件大小:14k
源码类别:
其他游戏
开发平台:
Visual Basic
- 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 zlqueryForm
- BackColor = &H00FFC0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "驾驶员资料查询"
- ClientHeight = 5745
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 9990
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 5745
- ScaleWidth = 9990
- StartUpPosition = 3 'Windows Default
- Begin VB.PictureBox Picture1
- BackColor = &H80000002&
- Height = 3015
- Left = 7800
- ScaleHeight = 2955
- ScaleWidth = 1995
- TabIndex = 12
- Top = 2640
- Width = 2055
- End
- Begin MSDataGridLib.DataGrid DataGrid1
- Bindings = "zlqueryForm.frx":0000
- Height = 3015
- Left = 120
- TabIndex = 10
- Top = 2640
- Width = 7575
- _ExtentX = 13361
- _ExtentY = 5318
- _Version = 393216
- AllowUpdate = -1 'True
- AllowArrows = -1 'True
- BackColor = 16761024
- HeadLines = 1
- RowHeight = 15
- 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 = 2
- 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
- SplitCount = 1
- BeginProperty Split0
- BeginProperty Column00
- EndProperty
- BeginProperty Column01
- EndProperty
- EndProperty
- End
- Begin VB.CommandButton Command1
- BackColor = &H00FFC0C0&
- Caption = "查找"
- Height = 495
- Left = 4440
- Style = 1 'Graphical
- TabIndex = 9
- Top = 2040
- Width = 2895
- End
- Begin VB.ComboBox Combo2
- Appearance = 0 'Flat
- BackColor = &H00FFC0C0&
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 420
- Left = 1920
- Style = 2 'Dropdown List
- TabIndex = 8
- Top = 2160
- Width = 1935
- End
- Begin VB.TextBox Text2
- Appearance = 0 'Flat
- BackColor = &H00FFC0C0&
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 510
- Left = 5760
- TabIndex = 6
- Top = 1305
- Width = 3495
- End
- Begin VB.ComboBox Combo1
- Appearance = 0 'Flat
- BackColor = &H00FFC0C0&
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 420
- Left = 1920
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 1440
- Width = 1935
- End
- Begin VB.TextBox Text1
- Appearance = 0 'Flat
- BackColor = &H00FFC0C0&
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 510
- Left = 2040
- TabIndex = 2
- Top = 705
- Width = 7215
- End
- Begin MSAdodcLib.Adodc zl_queryAdodc
- Height = 330
- Left = 1440
- Top = 1800
- 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 = ""
- 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
- _Version = 393216
- End
- Begin VB.Label Label6
- BackStyle = 0 'Transparent
- Caption = "驾驶员照片"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7920
- TabIndex = 11
- Top = 2040
- Width = 1695
- End
- Begin VB.Label Label5
- BackStyle = 0 'Transparent
- Caption = "比较符:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 120
- TabIndex = 7
- Top = 2160
- Width = 1335
- End
- Begin VB.Label Label4
- BackStyle = 0 'Transparent
- Caption = "比较数据:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4080
- TabIndex = 5
- Top = 1440
- Width = 1455
- End
- Begin VB.Label Label3
- BackStyle = 0 'Transparent
- Caption = "字段名称:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 120
- TabIndex = 3
- Top = 1440
- Width = 1455
- End
- Begin VB.Line Line1
- BorderColor = &H00FF8080&
- BorderWidth = 2
- X1 = 0
- X2 = 9600
- Y1 = 600
- Y2 = 600
- End
- Begin VB.Label Label2
- BackStyle = 0 'Transparent
- Caption = "查找表达式:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 120
- TabIndex = 1
- Top = 840
- Width = 1695
- End
- Begin VB.Label Label1
- BackColor = &H80000012&
- BackStyle = 0 'Transparent
- Caption = "驾驶员资料查询"
- BeginProperty Font
- Name = "方正舒体"
- Size = 24
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00008000&
- Height = 495
- Left = 2880
- TabIndex = 0
- Top = 120
- Width = 3495
- End
- End
- Attribute VB_Name = "zlqueryForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Combo1_Change()
- Call MankFindString
- End Sub
- Private Sub Combo2_Change()
- Call MankFindString
- End Sub
- ''资料查询满足条件的第一条记录
- Private Sub Command1_Click()
- Dim bol As Boolean
- Dim find As String
- find = MankFindString
- On Error GoTo MSG
- Screen.MousePointer = vbHourglass
- bol = zl_findfirst(find)
- Screen.MousePointer = vbDefault
- If bol = False Then
- MsgBox "没有查找到数据 !!!", 64, "提示对话框"
- End If
- Exit Sub
- MSG:
- MsgBox Err.Description
- End Sub
- Sub Form_Load()
- Dim revalu As Long
- zl_queryAdodc.Visible = False
- 'Me.Show '显示窗题
- '连接驾驶员资料表
- revalu = SetWindowPos(zlqueryForm.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, _
- 1 / 15 * Me.Width, 1 / 15 * Me.Height, SWP_SHOWWINDOW)
- Me.Left = (Screen.Width - Me.Width) / 2 - 100
- Me.Top = (Screen.Height - Me.Height) / 2 - 150
- Call lind_zldb
- zl_queryAdodc.Recordset.MoveFirst
- Call init(zl_queryAdodc.Recordset)
- End Sub
- '初始化数据库
- Sub init(rs As ADODB.Recordset)
- Dim i As Integer
- For i = 0 To rs.Fields.Count - 1 Step 1
- Combo1.AddItem rs.Fields(i).name
- Next i
- Combo1.ListIndex = 0
- '读入比较字符
- Combo2.AddItem "="
- Combo2.AddItem ">"
- Combo2.AddItem "<"
- Combo2.AddItem ">="
- Combo2.AddItem "<="
- Combo2.AddItem "<>"
- Combo2.AddItem "Like"
- Combo2.ListIndex = 0
- End Sub
- '构造比较字符串
- Function MankFindString() As String
- Dim s1 As String
- Dim s2 As String
- Dim shuju As String
- shuju = Text2.Text
- Dim findstring As String
- findstring = ""
- s1 = Combo1.List(Combo1.ListIndex)
- s2 = Combo2.List(Combo2.ListIndex)
- findstring = "[" & s1 & "]" & s2
- '根据不同的查找类型来构造不同的表达式
- 'MsgBox s1
- If Text2.Text <> "" Then
- Debug.Print zl_queryAdodc.Recordset.Fields(s1).Type
- Select Case zl_queryAdodc.Recordset.Fields(s1).Type
- Case 202
- findstring = findstring & " '" & shuju & "'"
- Case adDate
- '日期型
- findstring = findstring & "#" & shuju & "#"
- Case Else
- findstring = findstring & "" & shuju
- End Select
- End If
- MankFindString = findstring
- End Function
- Private Sub Text2_Change()
- Text1.Text = MankFindString
- End Sub
- '资料查询满足条件的第一条记录
- Function zl_findfirst(ByVal s As String) As Boolean
- On Error Resume Next
- Dim ss As String
- Dim h As String
- ss = Combo1.List(Combo1.ListIndex)
- h = Combo1.List(Combo1.ListIndex)
- zl_queryAdodc.CommandType = adCmdText
- Dim s1 As String
- Select Case zl_queryAdodc.Recordset.Fields(ss).Type
- Case 202
- zl_queryAdodc.RecordSource = "select * from 驾驶员资料表 where" & s
- Case adDate
- zl_queryAdodc.RecordSource = "select * from 驾驶员资料表 where" & s
- Case Else
- zl_queryAdodc.RecordSource = "select * from 驾驶员资料表 where" & s
- End Select
- zl_queryAdodc.Refresh
- If zl_queryAdodc.Recordset.RecordCount = 0 Then
- zl_findfirst = False
- Else
- zl_findfirst = True
- End If
- End Function