frmPermission.frm
上传用户:xianglong
上传日期:2022-06-19
资源大小:1105k
文件大小:8k
源码类别:

控制台编程

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
  4. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  5. Begin VB.Form frmPermission 
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "用户权限"
  8.    ClientHeight    =   5295
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   8775
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5295
  16.    ScaleWidth      =   8775
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  '所有者中心
  19.    Begin VB.Frame frame3 
  20.       Caption         =   "现有用户信息"
  21.       Height          =   5085
  22.       Left            =   120
  23.       TabIndex        =   3
  24.       Top             =   120
  25.       Width           =   3525
  26.       Begin MSDataListLib.DataList DataList1 
  27.          DataSource      =   "ado1"
  28.          Height          =   4470
  29.          Left            =   210
  30.          TabIndex        =   4
  31.          Top             =   330
  32.          Width           =   3120
  33.          _ExtentX        =   5503
  34.          _ExtentY        =   7885
  35.          _Version        =   393216
  36.          ListField       =   "name"
  37.       End
  38.       Begin MSAdodcLib.Adodc ado1 
  39.          Height          =   330
  40.          Left            =   120
  41.          Top             =   4680
  42.          Visible         =   0   'False
  43.          Width           =   2280
  44.          _ExtentX        =   4022
  45.          _ExtentY        =   582
  46.          ConnectMode     =   0
  47.          CursorLocation  =   3
  48.          IsolationLevel  =   -1
  49.          ConnectionTimeout=   15
  50.          CommandTimeout  =   30
  51.          CursorType      =   3
  52.          LockType        =   3
  53.          CommandType     =   2
  54.          CursorOptions   =   0
  55.          CacheSize       =   50
  56.          MaxRecords      =   0
  57.          BOFAction       =   0
  58.          EOFAction       =   0
  59.          ConnectStringType=   1
  60.          Appearance      =   1
  61.          BackColor       =   -2147483643
  62.          ForeColor       =   -2147483640
  63.          Orientation     =   0
  64.          Enabled         =   -1
  65.          Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbmaterialinfo2007.mdb;Persist Security Info=False"
  66.          OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbmaterialinfo2007.mdb;Persist Security Info=False"
  67.          OLEDBFile       =   ""
  68.          DataSourceName  =   ""
  69.          OtherAttributes =   ""
  70.          UserName        =   ""
  71.          Password        =   ""
  72.          RecordSource    =   "用户角色表"
  73.          Caption         =   "adoXS"
  74.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  75.             Name            =   "宋体"
  76.             Size            =   9
  77.             Charset         =   134
  78.             Weight          =   400
  79.             Underline       =   0   'False
  80.             Italic          =   0   'False
  81.             Strikethrough   =   0   'False
  82.          EndProperty
  83.          _Version        =   393216
  84.       End
  85.    End
  86.    Begin VB.CommandButton Command3 
  87.       Caption         =   "确定退出"
  88.       Height          =   375
  89.       Left            =   7080
  90.       TabIndex        =   2
  91.       Top             =   4800
  92.       Width           =   1545
  93.    End
  94.    Begin VB.CommandButton Command2 
  95.       Caption         =   "全不选"
  96.       Height          =   375
  97.       Left            =   5400
  98.       TabIndex        =   1
  99.       Top             =   4800
  100.       Width           =   1620
  101.    End
  102.    Begin VB.CommandButton Command1 
  103.       Caption         =   "全选"
  104.       Height          =   375
  105.       Left            =   3720
  106.       TabIndex        =   0
  107.       Top             =   4800
  108.       Width           =   1620
  109.    End
  110.    Begin TabDlg.SSTab SSTab1 
  111.       Height          =   4455
  112.       Left            =   3720
  113.       TabIndex        =   5
  114.       Top             =   240
  115.       Width           =   4935
  116.       _ExtentX        =   8705
  117.       _ExtentY        =   7858
  118.       _Version        =   393216
  119.       Tabs            =   1
  120.       TabsPerRow      =   1
  121.       TabHeight       =   520
  122.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  123.          Name            =   "宋体"
  124.          Size            =   9
  125.          Charset         =   134
  126.          Weight          =   400
  127.          Underline       =   0   'False
  128.          Italic          =   0   'False
  129.          Strikethrough   =   0   'False
  130.       EndProperty
  131.       TabCaption(0)   =   "用户权限设置"
  132.       TabPicture(0)   =   "frmPermission.frx":0000
  133.       Tab(0).ControlEnabled=   -1  'True
  134.       Tab(0).Control(0)=   "Check1(0)"
  135.       Tab(0).Control(0).Enabled=   0   'False
  136.       Tab(0).Control(1)=   "Check1(1)"
  137.       Tab(0).Control(1).Enabled=   0   'False
  138.       Tab(0).Control(2)=   "Check1(2)"
  139.       Tab(0).Control(2).Enabled=   0   'False
  140.       Tab(0).Control(3)=   "Check1(3)"
  141.       Tab(0).Control(3).Enabled=   0   'False
  142.       Tab(0).Control(4)=   "Check1(4)"
  143.       Tab(0).Control(4).Enabled=   0   'False
  144.       Tab(0).ControlCount=   5
  145.       Begin VB.CheckBox Check1 
  146.          Caption         =   "Check1"
  147.          Height          =   195
  148.          Index           =   4
  149.          Left            =   840
  150.          TabIndex        =   10
  151.          Top             =   3360
  152.          Width           =   1875
  153.       End
  154.       Begin VB.CheckBox Check1 
  155.          Caption         =   "Check1"
  156.          Height          =   225
  157.          Index           =   3
  158.          Left            =   840
  159.          TabIndex        =   9
  160.          Top             =   2520
  161.          Width           =   1875
  162.       End
  163.       Begin VB.CheckBox Check1 
  164.          Caption         =   "Check1"
  165.          Height          =   225
  166.          Index           =   2
  167.          Left            =   840
  168.          TabIndex        =   8
  169.          Top             =   1800
  170.          Width           =   1875
  171.       End
  172.       Begin VB.CheckBox Check1 
  173.          Caption         =   "Check1"
  174.          Height          =   225
  175.          Index           =   1
  176.          Left            =   840
  177.          TabIndex        =   7
  178.          Top             =   1080
  179.          Width           =   1875
  180.       End
  181.       Begin VB.CheckBox Check1 
  182.          Caption         =   "Check1"
  183.          Height          =   225
  184.          Index           =   0
  185.          Left            =   840
  186.          TabIndex        =   6
  187.          Top             =   480
  188.          Width           =   1875
  189.       End
  190.    End
  191. End
  192. Attribute VB_Name = "frmPermission"
  193. Attribute VB_GlobalNameSpace = False
  194. Attribute VB_Creatable = False
  195. Attribute VB_PredeclaredId = True
  196. Attribute VB_Exposed = False
  197. Dim rs1 As New ADODB.Recordset
  198. Dim i As Integer
  199. Function cnn() As ADODB.Connection
  200.   Set cnn = New ADODB.Connection
  201.   cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "dbmaterialinfo2007.mdb;Persist Security Info=False"
  202. End Function
  203. Private Sub Form_Activate()
  204.    ado1.Refresh
  205.    DataList1.SetFocus
  206. End Sub
  207. Private Sub Form_Load()
  208.   ado1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "dbmaterialinfo2007.mdb;Persist Security Info=False"
  209.   Set DataList1.RowSource = ado1
  210.   rs1.Open "用户角色表", cnn, adOpenKeyset, adLockOptimistic
  211.   For i = 0 To Check1.UBound
  212.       Check1(i).Caption = rs1.Fields(i).Name
  213.   Next i
  214.   rs1.Close
  215.   DataList1.Text = ado1.Recordset.Fields("name")
  216.   DataList1_Click
  217. End Sub
  218. Private Sub Command1_Click()     '全选
  219.   For i = 0 To Check1.UBound
  220.      Check1(i).Value = 1
  221.   Next i
  222. End Sub
  223. Private Sub Command2_Click()     '全不选
  224.   For i = 0 To Check1.UBound
  225.      Check1(i).Value = 0
  226.   Next i
  227. End Sub
  228. Private Sub Command3_Click()     '为操作员设置权限
  229.   rs1.Open "select * from   用户角色表  where name='" & DataList1.BoundText & "'", cnn, adOpenKeyset, adLockOptimistic
  230.   If rs1.RecordCount > 0 Then
  231.     For i = 0 To Check1.UBound
  232.        If Check1(i).Value = 1 Then rs1.Fields(i) = True Else rs1.Fields(i) = False
  233.     Next i
  234.    rs1.Update
  235.   End If
  236.   rs1.Close
  237.   
  238.  Unload Me
  239. End Sub
  240. Private Sub DataList1_Click()     '查看操作员权限
  241.  rs1.Open "select * from 用户角色表 where name='" & DataList1.BoundText & "'", cnn, adOpenKeyset, adLockOptimistic
  242.  SSTab1.Caption = "用户(" + Trim(DataList1.BoundText) + ")的权限设置"
  243.  If rs1.RecordCount > 0 Then
  244.   For i = 0 To Check1.UBound
  245.     If rs1.Fields(i) = True Then Check1(i).Value = 1 Else Check1(i).Value = 0
  246.   Next i
  247.   rs1.Update
  248.  End If
  249.  rs1.Close
  250. End Sub