main_jbzl_public.frm
上传用户:ake0106
上传日期:2022-07-23
资源大小:4052k
文件大小:12k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  5. Begin VB.Form main_jbzl_public 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "Form1"
  8.    ClientHeight    =   3825
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   5565
  12.    Icon            =   "main_jbzl_public.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   3825
  17.    ScaleWidth      =   5565
  18.    ShowInTaskbar   =   0   'False
  19.    StartUpPosition =   2  '屏幕中心
  20.    Begin MSAdodcLib.Adodc Adodc1 
  21.       Height          =   330
  22.       Left            =   270
  23.       Top             =   2310
  24.       Visible         =   0   'False
  25.       Width           =   2040
  26.       _ExtentX        =   3598
  27.       _ExtentY        =   582
  28.       ConnectMode     =   0
  29.       CursorLocation  =   3
  30.       IsolationLevel  =   -1
  31.       ConnectionTimeout=   15
  32.       CommandTimeout  =   30
  33.       CursorType      =   3
  34.       LockType        =   3
  35.       CommandType     =   8
  36.       CursorOptions   =   0
  37.       CacheSize       =   50
  38.       MaxRecords      =   0
  39.       BOFAction       =   0
  40.       EOFAction       =   0
  41.       ConnectStringType=   1
  42.       Appearance      =   1
  43.       BackColor       =   -2147483643
  44.       ForeColor       =   -2147483640
  45.       Orientation     =   0
  46.       Enabled         =   -1
  47.       Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  48.       OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_manpowerinfo"
  49.       OLEDBFile       =   ""
  50.       DataSourceName  =   ""
  51.       OtherAttributes =   ""
  52.       UserName        =   ""
  53.       Password        =   ""
  54.       RecordSource    =   ""
  55.       Caption         =   "Adodc1"
  56.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  57.          Name            =   "宋体"
  58.          Size            =   9
  59.          Charset         =   134
  60.          Weight          =   400
  61.          Underline       =   0   'False
  62.          Italic          =   0   'False
  63.          Strikethrough   =   0   'False
  64.       EndProperty
  65.       _Version        =   393216
  66.    End
  67.    Begin MSDataGridLib.DataGrid DataGrid1 
  68.       Height          =   2415
  69.       Left            =   0
  70.       TabIndex        =   2
  71.       Top             =   1395
  72.       Width           =   5520
  73.       _ExtentX        =   9737
  74.       _ExtentY        =   4260
  75.       _Version        =   393216
  76.       AllowUpdate     =   0   'False
  77.       HeadLines       =   1
  78.       RowHeight       =   15
  79.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  80.          Name            =   "宋体"
  81.          Size            =   9
  82.          Charset         =   134
  83.          Weight          =   400
  84.          Underline       =   0   'False
  85.          Italic          =   0   'False
  86.          Strikethrough   =   0   'False
  87.       EndProperty
  88.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  89.          Name            =   "宋体"
  90.          Size            =   9
  91.          Charset         =   134
  92.          Weight          =   400
  93.          Underline       =   0   'False
  94.          Italic          =   0   'False
  95.          Strikethrough   =   0   'False
  96.       EndProperty
  97.       ColumnCount     =   1
  98.       BeginProperty Column00 
  99.          DataField       =   ""
  100.          Caption         =   ""
  101.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  102.             Type            =   0
  103.             Format          =   ""
  104.             HaveTrueFalseNull=   0
  105.             FirstDayOfWeek  =   0
  106.             FirstWeekOfYear =   0
  107.             LCID            =   2052
  108.             SubFormatType   =   0
  109.          EndProperty
  110.       EndProperty
  111.       SplitCount      =   1
  112.       BeginProperty Split0 
  113.          MarqueeStyle    =   4
  114.          BeginProperty Column00 
  115.             ColumnWidth     =   4724.788
  116.          EndProperty
  117.       EndProperty
  118.    End
  119.    Begin MSComctlLib.ImageList ImageList1 
  120.       Left            =   0
  121.       Top             =   2550
  122.       _ExtentX        =   1005
  123.       _ExtentY        =   1005
  124.       BackColor       =   -2147483643
  125.       ImageWidth      =   32
  126.       ImageHeight     =   32
  127.       MaskColor       =   12632256
  128.       _Version        =   393216
  129.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  130.          NumListImages   =   8
  131.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  132.             Picture         =   "main_jbzl_public.frx":000C
  133.             Key             =   ""
  134.          EndProperty
  135.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  136.             Picture         =   "main_jbzl_public.frx":08E6
  137.             Key             =   ""
  138.          EndProperty
  139.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  140.             Picture         =   "main_jbzl_public.frx":11C0
  141.             Key             =   ""
  142.          EndProperty
  143.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  144.             Picture         =   "main_jbzl_public.frx":1A9A
  145.             Key             =   ""
  146.          EndProperty
  147.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  148.             Picture         =   "main_jbzl_public.frx":2774
  149.             Key             =   ""
  150.          EndProperty
  151.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  152.             Picture         =   "main_jbzl_public.frx":304E
  153.             Key             =   ""
  154.          EndProperty
  155.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  156.             Picture         =   "main_jbzl_public.frx":37C8
  157.             Key             =   ""
  158.          EndProperty
  159.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  160.             Picture         =   "main_jbzl_public.frx":44A2
  161.             Key             =   ""
  162.          EndProperty
  163.       EndProperty
  164.    End
  165.    Begin MSComctlLib.Toolbar Toolbar1 
  166.       Align           =   1  'Align Top
  167.       Height          =   795
  168.       Left            =   0
  169.       TabIndex        =   4
  170.       Top             =   0
  171.       Width           =   5565
  172.       _ExtentX        =   9816
  173.       _ExtentY        =   1402
  174.       ButtonWidth     =   1138
  175.       ButtonHeight    =   1349
  176.       Appearance      =   1
  177.       Style           =   1
  178.       ImageList       =   "ImageList1"
  179.       _Version        =   393216
  180.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  181.          NumButtons      =   8
  182.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  183.             Caption         =   " 增加 "
  184.             Key             =   "add"
  185.             ImageIndex      =   1
  186.          EndProperty
  187.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  188.             Caption         =   "修改"
  189.             Key             =   "modify"
  190.             ImageIndex      =   2
  191.          EndProperty
  192.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  193.             Caption         =   "删除"
  194.             Key             =   "delete"
  195.             ImageIndex      =   3
  196.          EndProperty
  197.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  198.             Style           =   3
  199.          EndProperty
  200.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  201.             Caption         =   "保存"
  202.             Key             =   "save"
  203.             ImageIndex      =   4
  204.          EndProperty
  205.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  206.             Caption         =   "取消"
  207.             Key             =   "cancel"
  208.             ImageIndex      =   5
  209.          EndProperty
  210.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  211.             Style           =   3
  212.          EndProperty
  213.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  214.             Caption         =   "关闭"
  215.             Key             =   "close"
  216.             ImageIndex      =   8
  217.          EndProperty
  218.       EndProperty
  219.       BorderStyle     =   1
  220.    End
  221.    Begin VB.Frame Frame1 
  222.       Height          =   615
  223.       Left            =   15
  224.       TabIndex        =   0
  225.       Top             =   765
  226.       Width           =   5520
  227.       Begin VB.TextBox Text1 
  228.          Height          =   330
  229.          Index           =   1
  230.          Left            =   1260
  231.          Locked          =   -1  'True
  232.          TabIndex        =   1
  233.          Top             =   180
  234.          Width           =   3405
  235.       End
  236.       Begin VB.Label Label1 
  237.          Caption         =   "label1"
  238.          Height          =   165
  239.          Left            =   150
  240.          TabIndex        =   3
  241.          Top             =   255
  242.          Width           =   1065
  243.       End
  244.    End
  245. End
  246. Attribute VB_Name = "main_jbzl_public"
  247. Attribute VB_GlobalNameSpace = False
  248. Attribute VB_Creatable = False
  249. Attribute VB_PredeclaredId = True
  250. Attribute VB_Exposed = False
  251. Dim rs1 As New ADODB.Recordset
  252. Public blnAdd As Boolean
  253. Dim mybookmark
  254. Sub tlbState(state As Boolean)
  255.   With Toolbar1
  256.     If state = True Then
  257.        .Buttons(1).Enabled = False
  258.        .Buttons(2).Enabled = False
  259.        .Buttons(3).Enabled = False
  260.        .Buttons(5).Enabled = True
  261.        .Buttons(6).Enabled = True
  262.     Else
  263.        .Buttons(1).Enabled = True
  264.        .Buttons(2).Enabled = True
  265.        .Buttons(3).Enabled = True
  266.        .Buttons(5).Enabled = False
  267.        .Buttons(6).Enabled = False
  268.      End If
  269.    End With
  270. End Sub
  271. Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  272.   If Adodc1.Recordset.RecordCount > 0 Then
  273.   mybookmark = DataGrid1.Bookmark
  274.   Text1(1) = DataGrid1.Columns(1)
  275.   End If
  276. End Sub
  277. Private Sub Form_Activate()
  278.   If jbxxtb <> "" Then
  279.     Adodc1.CommandType = adCmdTable
  280.     Adodc1.RecordSource = jbxxtb
  281.     Adodc1.Refresh
  282.     Set DataGrid1.DataSource = Adodc1
  283.   End If
  284. End Sub
  285. Private Sub Form_Load()
  286.   Me.Caption = text
  287.   tlbState False
  288.   Dim rs As New ADODB.Recordset
  289.   If jbxxtb <> "" Then
  290.   rs.Open jbxxtb, Cnn, adOpenKeyset, adLockOptimistic
  291.   Label1.Caption = rs.Fields(1).Name
  292.   rs.Close
  293.   End If
  294. End Sub
  295. Private Sub Text1_GotFocus(index As Integer)
  296.   Text1(index).BackColor = &HFFFF00
  297.   Text1(index).SelStart = 0
  298.   Text1(index).SelLength = Len(Text1(index))
  299. End Sub
  300. Private Sub Text1_LostFocus(index As Integer)
  301.   Text1(index).BackColor = &H80000005
  302. End Sub
  303. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  304.   Select Case Button.Key
  305.      Case "add"
  306.        blnAdd = True
  307.        tlbState True
  308.        Text1(1).Locked = False
  309.        Text1(1).SetFocus
  310.      Case "modify"
  311.        If Adodc1.Recordset.RecordCount > 0 Then
  312.          blnAdd = False
  313.          tlbState True
  314.          Text1(1).Locked = False
  315.        Else
  316.          MsgBox "系统没有要修改的数据!", , "提示窗口"
  317.        End If
  318.      Case "delete"
  319.        If Adodc1.Recordset.RecordCount > 0 Then
  320.          Adodc1.Recordset.Delete
  321.          Adodc1.Refresh
  322.        Else
  323.          MsgBox "系统没有要删除的数据!", , "提示窗口"
  324.        End If
  325.      Case "save"
  326.        On Error GoTo SaveErr
  327.        If Text1(1).text = "" Then
  328.           MsgBox "系统不允许" & Label1 & "为空!", , "提示窗口"
  329.           Exit Sub
  330.        End If
  331.        If blnAdd = True Then
  332.           Cnn.Execute ("insert into " & jbxxtb & "(" & Trim(Label1) & ") values('" + Text1(1) + "')")
  333.           Adodc1.Refresh
  334.           tlbState False
  335.           Text1(1).Locked = True
  336.         Else
  337.           Cnn.Execute ("update " & jbxxtb & " set " & Trim(Label1) & "='" + Text1(1) + "'where " & Trim(Label1) & "='" + DataGrid1.Columns(1) + "'")
  338.           Adodc1.Refresh
  339.           DataGrid1.Bookmark = mybookmark
  340.           tlbState False
  341.             Text1(1).Locked = True
  342.         End If
  343.         Exit Sub
  344. SaveErr:
  345.         MsgBox Err.Description
  346.      Case "cancel"
  347.        tlbState False
  348.        Text1(1).Locked = True
  349.      Case "close"
  350.        Unload Me
  351.   End Select
  352. End Sub