bx_Form.frm
上传用户:tashmp
上传日期:2010-04-03
资源大小:882k
文件大小:16k
源码类别:

其他游戏

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Begin VB.Form bx_Form 
  5.    BackColor       =   &H00FFC0C0&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "驾驶员表现管理"
  8.    ClientHeight    =   6840
  9.    ClientLeft      =   45
  10.    ClientTop       =   375
  11.    ClientWidth     =   9705
  12.    Icon            =   "bx_Form.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6840
  17.    ScaleWidth      =   9705
  18.    StartUpPosition =   3  'Windows Default
  19.    Begin VB.CommandButton Command4 
  20.       BackColor       =   &H00FFC0C0&
  21.       Caption         =   "删除"
  22.       Enabled         =   0   'False
  23.       Height          =   495
  24.       Left            =   7440
  25.       MaskColor       =   &H00FFFFFF&
  26.       Style           =   1  'Graphical
  27.       TabIndex        =   16
  28.       Top             =   6240
  29.       Width           =   1575
  30.    End
  31.    Begin VB.CommandButton Command3 
  32.       BackColor       =   &H00FFC0C0&
  33.       Caption         =   "修改"
  34.       Enabled         =   0   'False
  35.       Height          =   495
  36.       Left            =   3960
  37.       MaskColor       =   &H00FFFFFF&
  38.       Style           =   1  'Graphical
  39.       TabIndex        =   15
  40.       Top             =   6240
  41.       Width           =   1575
  42.    End
  43.    Begin VB.CommandButton Command2 
  44.       BackColor       =   &H00FFC0C0&
  45.       Caption         =   "添加"
  46.       Height          =   495
  47.       Left            =   600
  48.       MaskColor       =   &H00C0C0FF&
  49.       Style           =   1  'Graphical
  50.       TabIndex        =   14
  51.       Top             =   6240
  52.       Width           =   1575
  53.    End
  54.    Begin VB.Frame Frame3 
  55.       BackColor       =   &H00FFC0C0&
  56.       Caption         =   "驾驶员表现"
  57.       Height          =   3615
  58.       Left            =   240
  59.       TabIndex        =   11
  60.       Top             =   2520
  61.       Width           =   9255
  62.       Begin MSDataGridLib.DataGrid DataGrid1 
  63.          Bindings        =   "bx_Form.frx":030A
  64.          Height          =   1695
  65.          Left            =   7320
  66.          TabIndex        =   13
  67.          Top             =   960
  68.          Width           =   1455
  69.          _ExtentX        =   2566
  70.          _ExtentY        =   2990
  71.          _Version        =   393216
  72.          HeadLines       =   1
  73.          RowHeight       =   15
  74.          BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  75.             Name            =   "MS Sans Serif"
  76.             Size            =   8.25
  77.             Charset         =   0
  78.             Weight          =   400
  79.             Underline       =   0   'False
  80.             Italic          =   0   'False
  81.             Strikethrough   =   0   'False
  82.          EndProperty
  83.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  84.             Name            =   "MS Sans Serif"
  85.             Size            =   8.25
  86.             Charset         =   0
  87.             Weight          =   400
  88.             Underline       =   0   'False
  89.             Italic          =   0   'False
  90.             Strikethrough   =   0   'False
  91.          EndProperty
  92.          ColumnCount     =   2
  93.          BeginProperty Column00 
  94.             DataField       =   ""
  95.             Caption         =   ""
  96.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  97.                Type            =   0
  98.                Format          =   ""
  99.                HaveTrueFalseNull=   0
  100.                FirstDayOfWeek  =   0
  101.                FirstWeekOfYear =   0
  102.                LCID            =   2052
  103.                SubFormatType   =   0
  104.             EndProperty
  105.          EndProperty
  106.          BeginProperty Column01 
  107.             DataField       =   ""
  108.             Caption         =   ""
  109.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  110.                Type            =   0
  111.                Format          =   ""
  112.                HaveTrueFalseNull=   0
  113.                FirstDayOfWeek  =   0
  114.                FirstWeekOfYear =   0
  115.                LCID            =   2052
  116.                SubFormatType   =   0
  117.             EndProperty
  118.          EndProperty
  119.          SplitCount      =   1
  120.          BeginProperty Split0 
  121.             BeginProperty Column00 
  122.             EndProperty
  123.             BeginProperty Column01 
  124.             EndProperty
  125.          EndProperty
  126.       End
  127.       Begin MSAdodcLib.Adodc bx_Adodc 
  128.          Height          =   495
  129.          Left            =   7680
  130.          Top             =   360
  131.          Width           =   1215
  132.          _ExtentX        =   2143
  133.          _ExtentY        =   873
  134.          ConnectMode     =   0
  135.          CursorLocation  =   3
  136.          IsolationLevel  =   -1
  137.          ConnectionTimeout=   15
  138.          CommandTimeout  =   30
  139.          CursorType      =   3
  140.          LockType        =   3
  141.          CommandType     =   8
  142.          CursorOptions   =   0
  143.          CacheSize       =   50
  144.          MaxRecords      =   0
  145.          BOFAction       =   0
  146.          EOFAction       =   0
  147.          ConnectStringType=   1
  148.          Appearance      =   1
  149.          BackColor       =   -2147483643
  150.          ForeColor       =   -2147483640
  151.          Orientation     =   0
  152.          Enabled         =   -1
  153.          Connect         =   ""
  154.          OLEDBString     =   ""
  155.          OLEDBFile       =   ""
  156.          DataSourceName  =   ""
  157.          OtherAttributes =   ""
  158.          UserName        =   ""
  159.          Password        =   ""
  160.          RecordSource    =   ""
  161.          Caption         =   ""
  162.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  163.             Name            =   "MS Sans Serif"
  164.             Size            =   8.25
  165.             Charset         =   0
  166.             Weight          =   400
  167.             Underline       =   0   'False
  168.             Italic          =   0   'False
  169.             Strikethrough   =   0   'False
  170.          EndProperty
  171.          _Version        =   393216
  172.       End
  173.       Begin VB.TextBox Text5 
  174.          BackColor       =   &H00FFFFFF&
  175.          Height          =   3255
  176.          Left            =   240
  177.          MultiLine       =   -1  'True
  178.          TabIndex        =   12
  179.          Top             =   240
  180.          Width           =   8775
  181.       End
  182.    End
  183.    Begin VB.Frame Frame2 
  184.       BackColor       =   &H00FFC0C0&
  185.       Caption         =   "基本资料"
  186.       Height          =   1095
  187.       Left            =   240
  188.       TabIndex        =   4
  189.       Top             =   1200
  190.       Width           =   9255
  191.       Begin VB.TextBox Text4 
  192.          BackColor       =   &H00FFC0C0&
  193.          BeginProperty Font 
  194.             Name            =   "MS Sans Serif"
  195.             Size            =   12
  196.             Charset         =   0
  197.             Weight          =   700
  198.             Underline       =   0   'False
  199.             Italic          =   0   'False
  200.             Strikethrough   =   0   'False
  201.          EndProperty
  202.          Height          =   495
  203.          Left            =   7440
  204.          TabIndex        =   10
  205.          Top             =   360
  206.          Width           =   1695
  207.       End
  208.       Begin VB.TextBox Text3 
  209.          BackColor       =   &H00FFC0C0&
  210.          BeginProperty Font 
  211.             Name            =   "MS Sans Serif"
  212.             Size            =   12
  213.             Charset         =   0
  214.             Weight          =   700
  215.             Underline       =   0   'False
  216.             Italic          =   0   'False
  217.             Strikethrough   =   0   'False
  218.          EndProperty
  219.          Height          =   495
  220.          Left            =   4680
  221.          TabIndex        =   9
  222.          Top             =   360
  223.          Width           =   1695
  224.       End
  225.       Begin VB.TextBox Text2 
  226.          BackColor       =   &H00FFC0C0&
  227.          BeginProperty Font 
  228.             Name            =   "MS Sans Serif"
  229.             Size            =   12
  230.             Charset         =   0
  231.             Weight          =   700
  232.             Underline       =   0   'False
  233.             Italic          =   0   'False
  234.             Strikethrough   =   0   'False
  235.          EndProperty
  236.          Height          =   495
  237.          Left            =   1560
  238.          TabIndex        =   8
  239.          Top             =   360
  240.          Width           =   2055
  241.       End
  242.       Begin VB.Label Label4 
  243.          BackStyle       =   0  'Transparent
  244.          Caption         =   "年龄:"
  245.          BeginProperty Font 
  246.             Name            =   "MS Sans Serif"
  247.             Size            =   12
  248.             Charset         =   0
  249.             Weight          =   700
  250.             Underline       =   0   'False
  251.             Italic          =   0   'False
  252.             Strikethrough   =   0   'False
  253.          EndProperty
  254.          Height          =   375
  255.          Left            =   6720
  256.          TabIndex        =   7
  257.          Top             =   360
  258.          Width           =   855
  259.       End
  260.       Begin VB.Label Label3 
  261.          BackStyle       =   0  'Transparent
  262.          Caption         =   "姓名:"
  263.          BeginProperty Font 
  264.             Name            =   "MS Sans Serif"
  265.             Size            =   12
  266.             Charset         =   0
  267.             Weight          =   700
  268.             Underline       =   0   'False
  269.             Italic          =   0   'False
  270.             Strikethrough   =   0   'False
  271.          EndProperty
  272.          Height          =   375
  273.          Left            =   3720
  274.          TabIndex        =   6
  275.          Top             =   360
  276.          Width           =   855
  277.       End
  278.       Begin VB.Label Label2 
  279.          BackStyle       =   0  'Transparent
  280.          Caption         =   "驾照号码:"
  281.          BeginProperty Font 
  282.             Name            =   "MS Sans Serif"
  283.             Size            =   12
  284.             Charset         =   0
  285.             Weight          =   700
  286.             Underline       =   0   'False
  287.             Italic          =   0   'False
  288.             Strikethrough   =   0   'False
  289.          EndProperty
  290.          Height          =   375
  291.          Left            =   240
  292.          TabIndex        =   5
  293.          Top             =   360
  294.          Width           =   1335
  295.       End
  296.    End
  297.    Begin VB.Frame Frame1 
  298.       BackColor       =   &H00FFC0C0&
  299.       Height          =   855
  300.       Left            =   120
  301.       TabIndex        =   0
  302.       Top             =   120
  303.       Width           =   9375
  304.       Begin VB.CommandButton Command1 
  305.          BackColor       =   &H00FFC0C0&
  306.          Caption         =   "查询"
  307.          Height          =   495
  308.          Left            =   7200
  309.          Style           =   1  'Graphical
  310.          TabIndex        =   3
  311.          Top             =   240
  312.          Width           =   1935
  313.       End
  314.       Begin VB.TextBox Text1 
  315.          BackColor       =   &H00FFC0C0&
  316.          BeginProperty Font 
  317.             Name            =   "MS Sans Serif"
  318.             Size            =   13.5
  319.             Charset         =   0
  320.             Weight          =   700
  321.             Underline       =   0   'False
  322.             Italic          =   0   'False
  323.             Strikethrough   =   0   'False
  324.          EndProperty
  325.          Height          =   615
  326.          Left            =   2160
  327.          TabIndex        =   2
  328.          Top             =   120
  329.          Width           =   4935
  330.       End
  331.       Begin VB.Label Label1 
  332.          BackStyle       =   0  'Transparent
  333.          Caption         =   "输入驾照号码:"
  334.          BeginProperty Font 
  335.             Name            =   "MS Sans Serif"
  336.             Size            =   12
  337.             Charset         =   0
  338.             Weight          =   700
  339.             Underline       =   0   'False
  340.             Italic          =   0   'False
  341.             Strikethrough   =   0   'False
  342.          EndProperty
  343.          Height          =   375
  344.          Left            =   360
  345.          TabIndex        =   1
  346.          Top             =   240
  347.          Width           =   1695
  348.       End
  349.    End
  350. End
  351. Attribute VB_Name = "bx_Form"
  352. Attribute VB_GlobalNameSpace = False
  353. Attribute VB_Creatable = False
  354. Attribute VB_PredeclaredId = True
  355. Attribute VB_Exposed = False
  356. Option Explicit
  357. '查找驾驶员表现记录
  358. Private Sub Command1_Click()
  359. Dim i As Integer
  360. 'bx_Form.Command2.Enabled = False
  361. 'bx_Form.Command3.Enabled = False
  362. 'bx_Form.Command4.Enabled = False
  363. bx_Adodc.Recordset.MoveFirst
  364. For i = 0 To bx_Adodc.Recordset.RecordCount - 1 Step 1
  365.  If bx_Adodc.Recordset.Fields(0).Value = Text1.Text Then
  366.      Text2.Text = bx_Adodc.Recordset.Fields(0).Value
  367.      Text3.Text = bx_Adodc.Recordset.Fields(1).Value
  368.      Text4.Text = bx_Adodc.Recordset.Fields(2).Value
  369.      Text5.Text = bx_Adodc.Recordset.Fields(3).Value
  370.      Command3.Enabled = True
  371.      Command4.Enabled = True
  372.      Exit For
  373.  Else
  374.   bx_Adodc.Recordset.MoveNext
  375.   End If
  376. Next i
  377.  If i = bx_Adodc.Recordset.RecordCount Then
  378.   '没有查找到记录
  379.    Text2.Text = ""
  380.    Text3.Text = ""
  381.    Text4.Text = ""
  382.    Text5.Text = ""
  383.    
  384.    MsgBox "没有查找到记录!!!", 64, "查找提示!"
  385.   End If
  386. End Sub
  387. '添加记录
  388. Private Sub Command2_Click()
  389. 'MsgBox "ddd"
  390. If bx_Adodc.Recordset.EOF = True Then
  391.  bx_Adodc.Recordset.MoveLast
  392.  End If
  393. Dim flag As Boolean
  394. flag = True
  395. Command3.Enabled = False
  396. Command4.Enabled = False
  397. Debug.Print priview
  398. If priview = "admini" Then
  399.   If Text2.Text = "" Then
  400.     MsgBox "关键不能为空", 16, "友情提示"
  401.     Else
  402.      Dim i As Integer
  403.      For i = 0 To bx_Adodc.Recordset.RecordCount - 1 Step 1
  404.         If bx_Adodc.Recordset.Fields(0).Value = Text2.Text Then
  405.          flag = False
  406.          Exit For
  407.          End If
  408.      Next i
  409.        If flag = True Then
  410.       bx_Adodc.Recordset.AddNew
  411.       bx_Adodc.Recordset.Fields(0).Value = Text2.Text
  412.       bx_Adodc.Recordset.Fields(1).Value = Text3.Text
  413.       bx_Adodc.Recordset.Fields(2).Value = Text4.Text
  414.       bx_Adodc.Recordset.Fields(3).Value = Text5.Text
  415.       bx_Adodc.Recordset.Update
  416.        MsgBox "该记录以添加!!!", 46, "友情提示!!"
  417.       Else
  418.       MsgBox "该记录以存在!!!", 46, "友情提示!!"
  419.       End If
  420.   End If
  421.  Else
  422.  MsgBox "你没有使用权限!!!", 16, "友情提示"
  423. End If
  424. End Sub
  425. '修改记录
  426. Private Sub Command3_Click()
  427. If Text2 = "" Then
  428. MsgBox "主关键字不能为空!!!", 64, "友情提示!!"
  429. Else
  430. bx_Adodc.Recordset.Fields(0).Value = Text2
  431. bx_Adodc.Recordset.Fields(1).Value = Text3
  432. bx_Adodc.Recordset.Fields(2).Value = Text4
  433. bx_Adodc.Recordset.Fields(3).Value = Text5
  434. MsgBox "该记录以修改"
  435. End If
  436. End Sub
  437. '删除记录
  438. Private Sub Command4_Click()
  439. bx_Adodc.Recordset.Delete
  440. bx_Adodc.Recordset.MoveFirst
  441. Text2 = ""
  442. Text3 = ""
  443. Text4 = ""
  444. Text5.Text = ""
  445. MsgBox "该记录以删除!!", 64, "友情提示!!"
  446. End Sub
  447. '驾驶员表现管理
  448. Private Sub Form_Load()
  449. Dim revalu As Long
  450. bx_Adodc.Visible = False
  451. DataGrid1.Visible = False
  452. 'Me.Show '显示窗题
  453. '连接驾驶员资料表
  454.  revalu = SetWindowPos(bx_Form.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, _
  455.     1 / 15 * Me.Width, 1 / 15 * Me.Height, SWP_SHOWWINDOW)
  456.     Me.Left = (Screen.Width - Me.Width) / 2 - 100
  457.     Me.Top = (Screen.Height - Me.Height) / 2 - 150
  458.     
  459.     ''连接数据库
  460.     Call bx_linedb
  461.     
  462.     
  463. End Sub
  464. '连接数据库
  465. Sub bx_linedb()
  466. Dim dbpath As String
  467.  
  468. If Right(App.Path, 1) <> "" Then
  469. dbpath = App.Path & ""
  470. Else
  471. dbpath = App.Path
  472. End If
  473.  
  474.  '以管理员登陆
  475.  'MsgBox "gly"
  476. dbpath = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=" & dbpath & "年审评定数据库.mdb"
  477. bx_Adodc.ConnectionString = dbpath
  478. bx_Adodc.CommandType = adCmdText
  479. bx_Adodc.RecordSource = "select * from 驾驶员表现表"
  480. '动态连接数据库时一定要刷新数据库
  481. bx_Adodc.Refresh
  482. End Sub