以下是VB跟access做的操作权限的代码,如改为VB+SQL,怎么做?
代码如下:
Private Sub List1_Click() '选择管理员
Dim mydb1 As Database
Dim myrs1 As Recordset
mystr = List1.Text
Set mydb1 = Workspaces(0).OpenDatabase(App.Path & "\qxsz.mdb") '打开数据库
Set myrs1 = mydb1.OpenRecordset("qxsz", dbOpenSnapshot) '打开数据表
If myrs1.BOF = False Then myrs1.MoveFirst
myrs1.FindFirst "操作员 = '" & mystr & "'" '选择管理员
If myrs1.NoMatch Then
mystr = 0
Else '设置各项权限
Check1(0).Value = IIf(myrs1.Fields("客房预定") = -1, 1, 0)
Check1(1).Value = IIf(myrs1.Fields("住宿登记") = -1, 1, 0)
Check1(2).Value = IIf(myrs1.Fields("续住登记") = -1, 1, 0)
Check1(3).Value = IIf(myrs1.Fields("退宿登记") = -1, 1, 0)
Check1(4).Value = IIf(myrs1.Fields("客房管理") = -1, 1, 0)
END IF