下面是一个查询页面。由于要同时查询2个数据库,并且希望返回查询结果的条数总和,于是我定义了变量uui=uui+rs.recordcount,但最后的if uui=0 then这段调用代码无效,除非把它放在call getarea(cs,address)之后,但它必须要显示在页面的前面。
有没有什么办法解决呢?
- VBScript code
<%@language= "vbscript" codepage=65001%>
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" id='skin' type="text/css" href="../style/ymPrompt.css" />
<title>查询结果 </title>
</HEAD>
<BODY class="body-node">
<%
Set conn = Server.CreateObject("ADODB.Connection")
uui=0
function conninit(uid,pwd,svn)'初始化链接字符串
strconn = "Provider=OraOLEDB.Oracle.1;Password=" & pwd & ";User ID=" & uid & ";Data Source=" & svn
conn.connectionstring=strconn
end Function
'查询数据库A
function getarea(cs,address)
if cs <>"" or address <>"" then
call conninit("data","oracle","12")
conn.open()
sql="select 网点名称,负责人,电话,手机,省份,城市,派送范围 from tab_营业网点表 where 城市='"&cs&"' and 派送范围 like'%"&address&"%'"
set rs=Server.CreateObject("adodb.Recordset")
rs.open sql,conn,1,1
uui=uui+rs.recordcount
while not rs.eof
if address <>"" then
fw=replace(rs(6),address," <font color=red>"&address&" </font>")
else
fw=rs(6)
end if
response.Write(" <table align=center id=nodetable cellspacing=0>")
response.Write(" <tr>")
response.Write(" <th width=20% class=node>网点名称 </th>")
response.Write(" <th width=15% >负责人 </th>")
response.Write(" <th width=25% >联系电话 </th>")
response.Write(" <th width=25% >手机 </th>")
response.Write(" <th width=15% >城市 </th>")
response.Write(" </tr>")
response.Write(" <tr>")
response.Write(" <td class=specalt> "&rs(0)&" </th>")
response.Write(" <td> "&rs(1)&" </td>")
response.Write(" <td> "&rs(2)&" </td>")
response.Write(" <td> "&rs(3)&" </td>")
response.Write(" <td> "&rs(4)&" </td>")
response.Write(" </tr>")
response.Write(" <tr>")
response.Write(" <td width=20% valign=top class=area>服务范围 </td>")
response.Write(" <td width=80% colspan=4> "&fw&" </td>")
response.Write(" </tr>")
response.Write(" </table>")
response.Write(" <br clear=all />")
rs.movenext
wend
rs.close
conn.close
end if
end function
'查询数据库B
function getarea1(cs,address)
if cs <>"" or address <>"" then
call conninit("data","20090909","34")
conn.open()
sql="select 网点名称,负责人,电话,手机,省份,城市,派送范围 from tab_营业网点表 where 城市='"&cs&"' and 派送范围 like'%"&address&"%'"
set rs=Server.CreateObject("adodb.Recordset")
rs.open sql,conn,1,1
uui=uui+rs.recordcount
while not rs.eof
if address <>"" then