急急急,VB问题,DataList控件显示不出数据,就是显示不出操作员的姓名,能写上代码的最好
DimiAsInteger'定义一个整型变量DimssqlAsStringPrivateSubForm_Load()Adodc1.ConnectionString="Pr...
Dim i As Integer '定义一个整型变量
Dim ssql As String
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\宾馆管理.mdb;Persist Security Info=False"
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\宾馆管理.mdb;Persist Security Info=False"
For i = 1 To 4
Check1(i).Value = 1
Next i
End Sub
Private Sub DataList1_Click()
'查看操作员权限
Adodc2.RecordSource = "select * from Opera where 操作员='" & Trim(DataList1.BoundText) & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
list1.AddItem Adodc2.Recordset.Fields("操作员")
Adodc2.Recordset.MoveNext
Loop
For i = 1 To 4
If Adodc2.Recordset.Fields(i) = 0 Then Check1(i).Value = 1 Else Check1(i).Value = 0
Next i
Adodc2.Recordset.Update '更新记录
End If
End Sub
Private Sub Command1_Click()
'全选
For i = 1 To 4
Check1(i).Value = 1
Next i
End Sub
Private Sub Command2_Click()
'全不选
For i = 1 To 4
Check1(i).Value = 0
Next i
End Sub
Private Sub Command3_Click()
'为操作员设置权限
If DataList1.SelectedItem Then
If DataList1.BoundText <> "" Then
Adodc2.RecordSource = "select * from Opera where 操作员='" & DataList1.BoundText & "'"
Adodc2.Refresh
With Adodc2.Recordset
If .RecordCount > 0 Then
For i = 1 To 4
If Check1(i).Value = 1 Then .Fields(i) = 0 Else .Fields(i) = 1
Next i
.Update '更新记录
End If
End With
End If
MsgBox "设置权限已完成!"
Else
MsgBox "请选择操作员!"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
上面运行出来DataList控件显示不操作员的姓名
要怎么做才显示出,哪位高手能帮帮忙的,最好写代码上感激不尽
这样改不对,还是显示不出操作员的名字 展开
Dim ssql As String
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\宾馆管理.mdb;Persist Security Info=False"
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\宾馆管理.mdb;Persist Security Info=False"
For i = 1 To 4
Check1(i).Value = 1
Next i
End Sub
Private Sub DataList1_Click()
'查看操作员权限
Adodc2.RecordSource = "select * from Opera where 操作员='" & Trim(DataList1.BoundText) & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
Do While Adodc2.Recordset.EOF = False
list1.AddItem Adodc2.Recordset.Fields("操作员")
Adodc2.Recordset.MoveNext
Loop
For i = 1 To 4
If Adodc2.Recordset.Fields(i) = 0 Then Check1(i).Value = 1 Else Check1(i).Value = 0
Next i
Adodc2.Recordset.Update '更新记录
End If
End Sub
Private Sub Command1_Click()
'全选
For i = 1 To 4
Check1(i).Value = 1
Next i
End Sub
Private Sub Command2_Click()
'全不选
For i = 1 To 4
Check1(i).Value = 0
Next i
End Sub
Private Sub Command3_Click()
'为操作员设置权限
If DataList1.SelectedItem Then
If DataList1.BoundText <> "" Then
Adodc2.RecordSource = "select * from Opera where 操作员='" & DataList1.BoundText & "'"
Adodc2.Refresh
With Adodc2.Recordset
If .RecordCount > 0 Then
For i = 1 To 4
If Check1(i).Value = 1 Then .Fields(i) = 0 Else .Fields(i) = 1
Next i
.Update '更新记录
End If
End With
End If
MsgBox "设置权限已完成!"
Else
MsgBox "请选择操作员!"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
上面运行出来DataList控件显示不操作员的姓名
要怎么做才显示出,哪位高手能帮帮忙的,最好写代码上感激不尽
这样改不对,还是显示不出操作员的名字 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询