VB中SQL查询出来的数据怎么进行判断符不符合要求

2025-03-23 10:29:19
推荐回答(1个)
回答1:

dim rs as object
dim sql as string
    sql="select * from users where 姓名='xx' and 密码='xx'"
    set rs=currentproject.connection.execute sql
    if rs.eof then
        msgbox "账号或密码错误!"
    else        
        if rs(2)="有" then
            From1.Show
        elseif rs(3)="有" then
            From2.Show
        elseif rs(4)="有" then
            From3.Show
        else
            msgbox "啥权限都木有..."
        end if
    end if
    set rs=nothing

以上代码仅供参考,不太明白如果一个账号3个窗体都有权限,要开哪个?还是3个都开?

另外,如果以后你的系统添加新功能,有了四号窗体,是不是还要修改users表的结构??

通常用户表和权限表是分开的。