SQL 可以实现它有 用户管理功能
ASS 用程序吧,

解决方案 »

  1.   

    1 添加删除用户(我的一个实用窗体,超级管理员可以添加删除管理员) 
    VERSION 5.00
    Begin VB.Form frm_SysAdmin 
       BorderStyle     =   1  'Fixed Single
       Caption         =   "增加/删除管理员"
       ClientHeight    =   4335
       ClientLeft      =   45
       ClientTop       =   330
       ClientWidth     =   4500
       Icon            =   "frmSysAdmin.frx":0000
       KeyPreview      =   -1  'True
       LinkTopic       =   "Form1"
       MaxButton       =   0   'False
       MinButton       =   0   'False
       ScaleHeight     =   4335
       ScaleWidth      =   4500
       StartUpPosition =   2  '屏幕中心
       Begin VB.CommandButton Command3 
          Cancel          =   -1  'True
          Caption         =   "返回"
          Height          =   495
          Left            =   2760
          TabIndex        =   9
          Top             =   3480
          Width           =   1335
       End
       Begin VB.CommandButton Command2 
          Caption         =   "4"
          BeginProperty Font 
             Name            =   "Webdings"
             Size            =   15.75
             Charset         =   2
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Left            =   2760
          TabIndex        =   8
          Top             =   2760
          Width           =   1335
       End
       Begin VB.CommandButton Command1 
          Caption         =   "3"
          Default         =   -1  'True
          BeginProperty Font 
             Name            =   "Webdings"
             Size            =   15.75
             Charset         =   2
             Weight          =   400
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Left            =   2760
          TabIndex        =   7
          Top             =   2040
          Width           =   1335
       End
       Begin VB.TextBox txtPWD 
          Height          =   270
          IMEMode         =   3  'DISABLE
          Index           =   1
          Left            =   1680
          MaxLength       =   16
          PasswordChar    =   "*"
          TabIndex        =   2
          Top             =   1320
          Width           =   2415
       End
       Begin VB.TextBox txtPWD 
          Height          =   270
          IMEMode         =   3  'DISABLE
          Index           =   0
          Left            =   1680
          MaxLength       =   16
          PasswordChar    =   "*"
          TabIndex        =   1
          Top             =   960
          Width           =   2415
       End
       Begin VB.TextBox txtName 
          Height          =   270
          IMEMode         =   1  'ON
          Left            =   1680
          MaxLength       =   20
          TabIndex        =   0
          Top             =   360
          Width           =   2415
       End
       Begin VB.ListBox List1 
          Height          =   1860
          Left            =   360
          TabIndex        =   3
          Top             =   2040
          Width           =   2055
       End
       Begin VB.Label Label2 
          AutoSize        =   -1  'True
          Caption         =   "确认口令:"
          Height          =   180
          Index           =   1
          Left            =   480
          TabIndex        =   6
          Top             =   1320
          Width           =   900
       End
       Begin VB.Label Label2 
          AutoSize        =   -1  'True
          Caption         =   "预设口令:"
          Height          =   180
          Index           =   0
          Left            =   480
          TabIndex        =   5
          Top             =   960
          Width           =   900
       End
       Begin VB.Label Label1 
          AutoSize        =   -1  'True
          Caption         =   "管理员姓名:"
          Height          =   180
          Left            =   480
          TabIndex        =   4
          Top             =   360
          Width           =   1080
       End
    End
    Attribute VB_Name = "frm_SysAdmin"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Option Explicit
    Dim cnn As New ADODB.Connection, rs As RecordsetPrivate Sub Command1_Click()
    Dim n As LongIf Trim(txtName) = "" Then
    MSG "姓名不能空缺", 3
    txtName.SetFocus
    Exit Sub
    End If
    If Trim(txtPWD(0)) <> Trim(txtPWD(1)) Then
    MSG "口令确认有误", 3
    txtPWD(0).SetFocus
    Exit Sub
    End If
    n = FindStringinListControl(List1, Trim(txtName))
    If n >= 0 Then
    MSG Trim(txtName) & "已经存在", 3
    List1.ListIndex = n
    txtName.SetFocus
    Exit Sub
    End Ifrs.AddNew
    rs!Name = Trim(txtName)
    rs!Password = Trim(txtPWD(0))
    rs.Update
    List1.AddItem Trim(txtName)
    txtName.SetFocus
    End SubPrivate Sub Command2_Click()
    If List1.ListIndex = -1 Then Exit Sub
    rs.Requery
    rs.Find "name='" & List1.List(List1.ListIndex) & "'"
    rs.Delete
    List1.RemoveItem List1.ListIndex
    End SubPrivate Sub Command3_Click()
    Unload Me
    End SubPrivate Sub Form_Load()
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=consume.mdb;Persist Security Info=False" & ";Jet OLEDB:Database Password=" & dbPwd
    cnn.CursorLocation = adUseClient
    List1.Clear
    Set rs = New ADODB.Recordset
    Set rs.ActiveConnection = cnn
    rs.Open "select * from admin where name <> '超级管理员'", cnn, adOpenStatic, adLockOptimistic
    Do While Not rs.EOF
    List1.AddItem rs!Name
    rs.MoveNext
    Loop
    If List1.ListCount > 0 Then List1.ListIndex = 0
    End SubPrivate Sub Form_Unload(Cancel As Integer)
    rs.Close
    Set rs = Nothing
    cnn.Close
    Set cnn = Nothing
    End Sub
    Private Sub txtName_GotFocus()
    txtName.SelStart = 0
    txtName.SelLength = 20
    End SubPrivate Sub txtPWD_GotFocus(Index As Integer)
    txtPWD(Index).SelStart = 0
    txtPWD(Index).SelLength = 16
    End Sub2 在模块中声明一个公共变量public currentUser as string
    当用户登录时,赋给它用户名。
    进入任何一个浏览内容的窗体时,根据currentUser确定他的范围,用不同的SQL where字句提取数据。
      

  2.   

    在表里除了保存用户名和密码外
    加一个字段表示该用户的权限比如admin可以设为255...普通用户可以为1,高级用户为10...等在程序中判断该用户的权限值然后提供相应的功能给该用户
      

  3.   

    如何将前N个记录的某数据字段求和后插在N,N+1条记录之间?用SQL实现。