jfForm.frm
资源名称:七八个vb游戏.rar [点击查看]
上传用户:tashmp
上传日期:2010-04-03
资源大小:882k
文件大小:13k
源码类别:
其他游戏
开发平台:
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 jfForm
- BackColor = &H00FFC0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "驾驶员积分查询 "
- ClientHeight = 6555
- ClientLeft = 45
- ClientTop = 375
- ClientWidth = 10110
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6555
- ScaleWidth = 10110
- StartUpPosition = 3 'Windows Default
- Begin VB.Frame Frame1
- BackColor = &H00FFC0C0&
- Caption = "查询结果"
- Height = 3855
- Left = 0
- TabIndex = 9
- Top = 2640
- Width = 10095
- Begin MSDataGridLib.DataGrid DataGrid1
- Bindings = "jfForm.frx":0000
- Height = 3495
- Left = 120
- TabIndex = 10
- Top = 240
- Width = 9855
- _ExtentX = 17383
- _ExtentY = 6165
- _Version = 393216
- BackColor = -2147483647
- 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
- End
- Begin MSAdodcLib.Adodc jf_queryAdodc
- Height = 495
- Left = 7320
- Top = 1920
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 873
- 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 = "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.ComboBox Combo2
- BackColor = &H00FFC0C0&
- Height = 315
- Left = 1920
- TabIndex = 8
- Text = "Combo2"
- Top = 1920
- Width = 2055
- End
- Begin VB.CommandButton Command1
- BackColor = &H00FFC0C0&
- Caption = "查询"
- Height = 495
- Left = 8160
- Style = 1 'Graphical
- TabIndex = 6
- Top = 240
- Width = 1575
- End
- Begin VB.TextBox Text2
- 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 = 495
- Left = 5880
- TabIndex = 5
- Top = 1320
- Width = 3615
- End
- Begin VB.ComboBox Combo1
- BackColor = &H00FFC0C0&
- Height = 315
- Left = 1920
- Style = 2 'Dropdown List
- TabIndex = 3
- Top = 1320
- Width = 2055
- End
- Begin VB.TextBox Text1
- BackColor = &H00FFFFFF&
- Enabled = 0 'False
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 615
- Left = 1920
- TabIndex = 1
- Top = 240
- Width = 6015
- End
- Begin VB.Line Line2
- X1 = 0
- X2 = 10080
- Y1 = 2520
- Y2 = 2520
- 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 = 120
- TabIndex = 7
- Top = 2040
- Width = 1215
- End
- Begin VB.Line Line1
- BorderColor = &H00C0FFFF&
- BorderWidth = 2
- X1 = 0
- X2 = 10080
- Y1 = 1080
- Y2 = 1080
- 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 = 4200
- TabIndex = 4
- Top = 1320
- Width = 1455
- 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 = 2
- Top = 1320
- Width = 1455
- End
- Begin VB.Label Label1
- 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 = 495
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 1935
- End
- End
- Attribute VB_Name = "jfForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Combo1_Change()
- Text1.Text = MankFindString_jf
- End Sub
- Private Sub Combo2_Change()
- Text1.Text = MankFindString_jf
- End Sub
- '查询记录
- Private Sub Command1_Click()
- On Error GoTo MSG
- Dim bol As Boolean
- Dim find As String
- find = MankFindString_jf()
- 'Screen.MousePointer = vbHourglass
- bol = jf_findfirst(find)
- 'Screen.MousePointer = vbDefault
- Debug.Print bol
- If bol = False Then
- MsgBox "没有查找到数据 !!!", 64, "提示对话框"
- End If
- Exit Sub
- MSG:
- MsgBox Err.Description
- End Sub
- Private Sub Form_Load()
- Dim revalu As Long
- jf_queryAdodc.Visible = False
- 'Me.Show '显示窗题
- '连接驾驶员资料表
- revalu = SetWindowPos(jfForm.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, _
- 1 / 15 * Me.Width, 1 / 15 * Me.Height, SWP_SHOWWINDOW)
- Me.Left = (Screen.Width - Me.Width) / 2 - 150
- Me.Top = (Screen.Height - Me.Height) / 2 - 150
- ''连接数据库
- '积分表
- Call line_jfdb
- Call init_jf(jf_queryAdodc.Recordset)
- End Sub
- '连接数据库
- '积分表
- Sub line_jfdb()
- Dim dbpath As String
- If Right(App.Path, 1) <> "" Then
- dbpath = App.Path & ""
- Else
- dbpath = App.Path
- End If
- '以管理员登陆
- 'MsgBox "gly"
- dbpath = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=" & dbpath & "年审评定数据库.mdb"
- jf_queryAdodc.ConnectionString = dbpath
- jf_queryAdodc.CommandType = adCmdText
- jf_queryAdodc.RecordSource = "select * from 驾驶员积分管理表"
- '动态连接数据库时一定要刷新数据库
- jf_queryAdodc.Refresh
- End Sub
- '连接数据库后初始化
- Sub init_jf(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_jf() 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 jf_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_jf = findstring
- End Function
- '资料查询满足条件的第一条记录
- Function jf_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)
- jf_queryAdodc.CommandType = adCmdText
- Dim s1 As String
- Select Case jf_queryAdodc.Recordset.Fields(ss).Type
- Case 202
- jf_queryAdodc.RecordSource = "select * from 驾驶员积分管理表 where" & s
- Case adDate
- jf_queryAdodc.RecordSource = "select * from 驾驶员积分管理表 where" & s
- Case Else
- jf_queryAdodc.RecordSource = "select * from 驾驶员积分管理表 where" & s
- End Select
- jf_queryAdodc.Refresh
- If jf_queryAdodc.Recordset.RecordCount = 0 Then
- jf_findfirst = False
- Else
- jf_findfirst = True
- End If
- End Function
- Private Sub Text2_Change()
- Text1.Text = MankFindString_jf
- End Sub