rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '运用API函数SetWindowPos,来实现使窗体置前的功能
'通过代码连接数据库
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=YCSystem;Data Source=1T1AODBJZJMNDV7"
Adodc1.RecordSource = "select * from tb_enter" '连接操作员信息表
Adodc1.Refresh
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
i = 1
If Adodc1.Recordset.RecordCount > 0 Then
ListView1.Enabled = True
ListView1.ListItems.Clear '刷新ListView控件
Adodc1.Recordset.MoveFirst
'Set ListView1.ListItems = ImageList1
Do While Adodc1.Recordset.EOF = False '向ListView控件中添加操作员信息
key = Adodc1.Recordset.Fields("M_Name")
Set itmX = ListView1.ListItems.Add(, , key, i)
i = i + 1
Adodc1.Recordset.MoveNext
Loop
On Error Resume Next
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + ListView1.SelectedItem + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then '将操作员所具有的权限信息显示在相应的Check控件当中
Check1.Value = Adodc1.Recordset.Fields("1")
Check2.Value = Adodc1.Recordset.Fields("2")
Check3.Value = Adodc1.Recordset.Fields("3")
Check4.Value = Adodc1.Recordset.Fields("4")
Check5.Value = Adodc1.Recordset.Fields("5")
Check6.Value = Adodc1.Recordset.Fields("6")
Check7.Value = Adodc1.Recordset.Fields("7")
Check8.Value = Adodc1.Recordset.Fields("8")
Check9.Value = Adodc1.Recordset.Fields("9")
Check10.Value = Adodc1.Recordset.Fields("10")
End If
Else
ListView1.Enabled = False '如果数据库中没有操作员信息,则将ListView控件设置为不可用状态
End If
SSTab1.Rows = 2
End Sub
3 个解决方案
#1
#3
为什么拉屎前要先脱裤子。
#1
#2
#3
为什么拉屎前要先脱裤子。