老是出错,很郁闷.(问题已解决)
这是一个系统登录程序,连接SQL数据库的.数据库里有一个文件叫tb_enter,M_Name为用户名.图及代码如下:Private Sub Form_Activate() '给登录的操作员授予权限
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Name1 + "'"
Adodc1.Refresh '(老是在这个地方显示出错)
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.Fields("1") = 1 Then
CKSZ.Enabled = True
ElseIf Adodc1.Recordset.Fields("1") = 0 Then
CKSZ.Enabled = False
End If
If Adodc1.Recordset.Fields("2") = 1 Then
QCKCSZ.Enabled = True
ElseIf Adodc1.Recordset.Fields("2") = 0 Then
QCKCSZ.Enabled = False
End If
If Adodc1.Recordset.Fields("3") = 1 Then
HPRKGL.Enabled = True
Toolbar1.Buttons(1).Enabled = True
ElseIf Adodc1.Recordset.Fields("3") = 0 Then
HPRKGL.Enabled = False
Toolbar1.Buttons(1).Enabled = False
End If
If Adodc1.Recordset.Fields("4") = 1 Then
HPCKGL.Enabled = True
Toolbar1.Buttons(3).Enabled = True
ElseIf Adodc1.Recordset.Fields("4") = 0 Then
HPCKGL.Enabled = False
Toolbar1.Buttons(3).Enabled = False
End If
If Adodc1.Recordset.Fields("5") = 1 Then
HPPDGL.Enabled = True
ElseIf Adodc1.Recordset.Fields("5") = 0 Then
HPPDGL.Enabled = False
End If
If Adodc1.Recordset.Fields("6") = 1 Then
RKXXCX.Enabled = True
ElseIf Adodc1.Recordset.Fields("6") = 0 Then
RKXXCX.Enabled = False
End If
If Adodc1.Recordset.Fields("7") = 1 Then
CKXXCX.Enabled = True
ElseIf Adodc1.Recordset.Fields("7") = 0 Then
CKXXCX.Enabled = False
End If
If Adodc1.Recordset.Fields("8") = 1 Then
KCXXCX.Enabled = True
Toolbar1.Buttons(6).Enabled = True
ElseIf Adodc1.Recordset.Fields("8") = 0 Then
KCXXCX.Enabled = False
Toolbar1.Buttons(6).Enabled = False
End If
If Adodc1.Recordset.Fields("9") = 1 Then
CRKXXRTJ.Enabled = True
Toolbar1.Buttons(8).Enabled = True
ElseIf Adodc1.Recordset.Fields("9") = 0 Then
CRKXXRTJ.Enabled = False
Toolbar1.Buttons(8).Enabled = False
End If
If Adodc1.Recordset.Fields("10") = 1 Then
PRINTOUT.Enabled = True
ElseIf Adodc1.Recordset.Fields("10") = 0 Then
PRINTOUT.Enabled = False
End If
If Adodc1.Recordset.Fields("11") = 1 Then
PRINTKC.Enabled = True
ElseIf Adodc1.Recordset.Fields("11") = 0 Then
PRINTKC.Enabled = False
End If
If Adodc1.Recordset.Fields("12") = 1 Then
CZYXXWH.Enabled = True
ElseIf Adodc1.Recordset.Fields("12") = 0 Then
CZYXXWH.Enabled = False
End If
If Adodc1.Recordset.Fields("13") = 1 Then
MMXG.Enabled = True
ElseIf Adodc1.Recordset.Fields("13") = 0 Then
MMXG.Enabled = False
End If
If Adodc1.Recordset.Fields("14") = 1 Then
CZYQXSZ.Enabled = True
ElseIf Adodc1.Recordset.Fields("14") = 0 Then
CZYQXSZ.Enabled = False
End If
If Adodc1.Recordset.Fields("15") = 1 Then
SJBF.Enabled = True
Toolbar1.Buttons(10).Enabled = True
ElseIf Adodc1.Recordset.Fields("15") = 0 Then
SJBF.Enabled = False
Toolbar1.Buttons(10).Enabled = False
End If
If Adodc1.Recordset.Fields("16") = 1 Then
SJHF.Enabled = True
Toolbar1.Buttons(12).Enabled = True
ElseIf Adodc1.Recordset.Fields("16") = 0 Then
SJHF.Enabled = False
Toolbar1.Buttons(12).Enabled = False
End If
If Adodc1.Recordset.Fields("17") = 1 Then
SJQL.Enabled = True
ElseIf Adodc1.Recordset.Fields("17") = 0 Then
SJQL.Enabled = False
End If
If Adodc1.Recordset.Fields("18") = 1 Then
RZQL.Enabled = True
ElseIf Adodc1.Recordset.Fields("18") = 0 Then
RZQL.Enabled = False
End If
If Adodc1.Recordset.Fields("19") = 1 Then
HPJC.Enabled = True
ElseIf Adodc1.Recordset.Fields("19") = 0 Then
HPJC.Enabled = False
End If
If Adodc1.Recordset.Fields("20") = 1 Then
HPGH.Enabled = True
ElseIf Adodc1.Recordset.Fields("20") = 0 Then
HPGH.Enabled = False
End If
If Adodc1.Recordset.Fields("21") = 1 Then
GYSXXWH.Enabled = True
ElseIf Adodc1.Recordset.Fields("21") = 0 Then
GYSXXWH.Enabled = False
End If
End If
End Sub
[此贴子已经被作者于2007-8-3 7:47:01编辑过]