注册 登录
编程论坛 VB6论坛

adodc1.refresh出错怎么改

yxw123 发布于 2017-04-18 19:48, 3747 次点击
Private Sub cmdLogin_Click()


ss = txtUserName.Text


Adodc1.RecordSource = "SELECT * FROM  管理员 where 管理员号='" + ss + "'"


Adodc1.Refresh


If Adodc1.Recordset.BOF = True And Adodc1.Recordset.EOF = True Then

MsgBox "查无此人", , "登陆信息"
Else
 
     
     If Adodc1.Recordset.Fields(1) = txtPassword.Text Then
        
         ''''''''''''''''''''''''''''''''''''''''''
        MsgBox "身份正确", , "登陆信息"
     
     
     Adodc1.RecordSource = "select 权限1,权限2,权限3 from 管理员 where 管理员号='" + ss + "'"
    Adodc1.Refresh
   
 工具室管理系统.用户管理.Enabled = Adodc1.Recordset.Fields(0).Value
   工具室管理系统.设置权限.Enabled = Adodc1.Recordset.Fields(1).Value
   工具室管理系统.初期设置.Enabled = Adodc1.Recordset.Fields(2).Value
   
     
       工具室管理系统.Show
         
         Unload Me
        
      
           '''''''''''''''''''''''''''''''''''''''''''''''''''
     Else
        MsgBox "密码不正确", , "登陆信息"
     End If
  
 
  End If
   

End Sub
3 回复
#2
xiangyue05102017-04-19 08:39
ADODC1.ConnectionString 设置否?
另外,adodc属性-记录源--命令类型选择(1-adCmdText),如果命令类型选成2,后面好像就会出错
#3
ZHRXJR2017-04-21 18:32
只说 adodc1.refresh出错怎么改,什么错误不知道,只能瞎猜了
1、Adodc1.ConnectionString = ""   '这个没有不知道是否已经设置了
2、 =  '的属性是否设置,不知道,一般有个设置为 adCmdText
3、Adodc1.RecordSource = "SELECT * FROM  管理员 where 管理员号='" + ss + "'"   '管理员号字段不知是什么数据类型,如果是字符型,没有问题,如果是数字型就不对,修改为:
Adodc1.RecordSource = "SELECT * FROM  管理员 where 管理员号=" & ss & ""   '连接符最好使用 & 号
#4
Artless2017-04-23 01:54
错误码
1