求教一个vb的语法问题
求教一个vb的语法问题:下面是一个验证用户密码的函数,谁能告诉我这个语句是什么意思“PassIsTrue = (Rs(0).Value = 1)”,难道是vb中if判断简化写法?
''''''''''''''''''''''''''
Public Function PassIsTrue(ByVal strUname As String, ByVal strPass As String, Optional ByVal strTable As String = "Users") As Boolean
Dim Rs As Recordset
Set Rs = g_Conn.Execute("SELECT COUNT(*) FROM " & strTable & " Where UserName='" & strUname & "' and Upass='" & strPass & "'")
PassIsTrue = (Rs(0).Value = 1)
Set Rs = Nothing
End Function
[解决办法]
Rs(0).Value = 1 返回一个布尔表达式 true or false
然后赋值给PassIsTrue
[解决办法]
PassIsTrue = (Rs(0).Value = 1
返回一个布尔值 TRUE or FALSE ! (真假两个值)
if 判断语句的返回结果类似它 条件要么成立,要么不成立(也是两个值)