请看这条vb 语句什么意思?

来源:百度知道 编辑:UC知道 时间:2024/05/31 06:39:43
if rs2.recordcount<>0 then
fontcolor=rs2("fontcolor")

if rs("titlecolor")="默认颜色" then
fontcolor=rs2("fontcolor")
else
fontcolor=rs("titlecolor")
end if
end if

请问两个 end if 分别和哪两个 if 匹配?第一个if语句的then后面执行的是复合语句吗?

1----if rs2.recordcount<>0 then
| fontcolor=rs2("fontcolor")
| 2----if rs("titlecolor")="默认颜色" then
| | fontcolor=rs2("fontcolor")
| 2 else
| | fontcolor=rs("titlecolor")
| 2----end if
1----end if

就是这样的,第一个if语句的then后面执行的是复合语句

if rs("titlecolor")="默认颜色" then
fontcolor=rs2("fontcolor")
else
fontcolor=rs("titlecolor")
end if
你把这个程序段看成一块,或者看成一句完整的语句(因为if要和end if配对才完整)
这样就清晰了

比如把这段当成a(当然不可能一样)
代码就成了

if rs2.recordcount<>0 then
fontcolor=rs2("fontcolor")
a
end if
还是完整的一段。。。

if rs("titlecolor")="默认颜色" then
fontcolor=rs2("fontcolor")
else
fontcolor=rs("titlecolor")
end if

明白了吧