if-else语句相关问题 [英] if-else statement related question
本文介绍了if-else语句相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这似乎是一个非常简单的问题,但我想问一下这个条件是什么意思?
if instr(LCase (Request.ServerVariables( HTTP_HOST)), corpwebdev)> 0 或 instr(LCase(Request.ServerVariables( HTTP_HOST)), _ train)> 0 然后
cnOracle.Open PROVIDER = MSDAORA; DATA SOURCE = TestDB; USER ID = DBuser; PASSWORD = DBuser
else
cnOracle.Open PROVIDER = MSDAORA; DATA SOURCE = ProdDB; USER ID = DBuser; PASSWORD = DBuser
end if
欺骗我的是if instr(LCase(Request.ServerVariables(HTTP_HOST)),stluscorpwebdev)> 0或instr(LCase(请求) .ServerVariables(HTTP_HOST)),_ train)> 0部分。
提前谢谢!
解决方案
如果你google HTTP_HOST,你会看到它存储要求的资源的Internet主机和端口号。 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html# sec14.23 [ ^ ]
此代码使用不同的连接字符串(显示为测试与生产数据库),具体取决于代码运行的服务器。
This may seem like a pretty easy question but I would like to ask what does this condition says?
if instr(LCase(Request.ServerVariables("HTTP_HOST")),"corpwebdev") > 0 or instr(LCase(Request.ServerVariables("HTTP_HOST")),"_train") > 0 then
cnOracle.Open "PROVIDER=MSDAORA;DATA SOURCE=TestDB;USER ID=DBuser;PASSWORD=DBuser"
else
cnOracle.Open "PROVIDER=MSDAORA;DATA SOURCE=ProdDB;USER ID=DBuser;PASSWORD=DBuser"
end if
The one that tricks me is the "if instr(LCase(Request.ServerVariables("HTTP_HOST")),"stluscorpwebdev") > 0 or instr(LCase(Request.ServerVariables("HTTP_HOST")),"_train") > 0" part.
Thank you in advance!
解决方案
If you google HTTP_HOST you'll see that it stores "the Internet host and port number of the resource being requested." http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23[^]
This code uses a different connection string (to a test vs production db it appears) depending on which server the code is running on.
这篇关于if-else语句相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文