同一个ASP页面调用两个本地数据库

来源:百度知道 编辑:UC知道 时间:2024/05/31 05:46:49
本地SQL Server数据库A和B都有表fsd_info,并且结构相同,A和B都是从网上更新数据,我想把它改成A从网上更新,B从A更新,下面是B的ASP代码,请问怎么修改?
<!--#include file="../conn.asp"-->
<%
url="http://......................................"
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET",url,False
http.send
Set xml=Server.CreateObject("Microsoft.XMLDOM")
xml.Async=true
xml.ValidateOnParse=False
xml.Load(http.ResponseXML)
Set title=xml.getElementsByTagName("row")
kjsj=cdate(title.item(0).attributes.getNamedItem("opentime").text)
qihao=clng(title.item(0).attributes.getNamedItem("expect").text)
haoma=title.item(0).attributes.getNamedItem("opencode").text
if haoma<>""then
hm=split(haoma,",")
hm1=hm(0)
hm2=hm(1)
hm3=hm(2

<!--#include file="../conn.asp"-->
<!--#include file="../connA.asp"-->
<%
此处注意是connA也就是你A数据库的连接。你可以再做一个connA.asp文件,连接你的数据库A
然后通过 <!--#include file="../connA.asp"-->,注意命名。
ASP语法可以有地方有写错误,毕竟好久没用了,逻辑肯定对

set rs=server.CreateObject("adodb.recordset")
sql="select top 1 lottery_num,num_info1,num_info2,num_info3,kjtime from fsd_info order by addtime desc"
rs.open sql,connA,1,1

dim qihao
dim hm1
dim hm2
dim hm3
dim kjsj

if not(rs.eof and rs.bof) then

kjsj =rs("kjtime")
qihao =rs("lottery_num")
hm1=rs("num_info1")
hm2=rs("num_info2")
hm3=rs("num_info3")
haoma = hm1&","&hm2&","&hm3
end if
rs.close()
set rs=nothing

response.write "第"&qihao&"期,第:"& haoma&"号"& kjsj