同一个ASP页面调用两个本地数据库
本地SQLServer数据库A和B都有表fsd_info,并且结构相同,A和B都是从网上更新数据,我想把它改成A从网上更新,B从A更新,下面是B的ASP代码,请问怎么修改...
本地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)
end if
response.write "第"&qihao&"期,第:"& haoma&"号"& kjsj
set rs=server.CreateObject("adodb.recordset")
sql="select top 1 lottery_num from fsd_info order by addtime desc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
if StrComp(rs("lottery_num"),qihao)<>0 and qihao<>"" and haoma<>"" then
sql = "insert into fsd_info(lottery_num,num_info1,num_info2,num_info3,addtime,kjtime) values('"&qihao&"','"&hm1&"','"&hm2&"','"&hm3&"','"&now()&"','"&kjsj&"')"
conn.execute(sql)
response.Redirect("chkwin.asp?lt=fsd&cp_num="&qihao&"")
end if
end if
set rs=nothing
%> 展开
<!--#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)
end if
response.write "第"&qihao&"期,第:"& haoma&"号"& kjsj
set rs=server.CreateObject("adodb.recordset")
sql="select top 1 lottery_num from fsd_info order by addtime desc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
if StrComp(rs("lottery_num"),qihao)<>0 and qihao<>"" and haoma<>"" then
sql = "insert into fsd_info(lottery_num,num_info1,num_info2,num_info3,addtime,kjtime) values('"&qihao&"','"&hm1&"','"&hm2&"','"&hm3&"','"&now()&"','"&kjsj&"')"
conn.execute(sql)
response.Redirect("chkwin.asp?lt=fsd&cp_num="&qihao&"")
end if
end if
set rs=nothing
%> 展开
展开全部
<!--#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
set rs=server.CreateObject("adodb.recordset")
sql="select top 1 lottery_num from fsd_info order by addtime desc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
if StrComp(rs("lottery_num"),qihao)<>0 and qihao<>"" and haoma<>"" then
sql = "insert into fsd_info(lottery_num,num_info1,num_info2,num_info3,addtime,kjtime) values('"&qihao&"','"&hm1&"','"&hm2&"','"&hm3&"','"&now()&"','"&kjsj&"')"
conn.execute(sql)
response.Redirect("chkwin.asp?lt=fsd&cp_num="&qihao&"")
end if
end if
set rs=nothing
%>
<!--#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
set rs=server.CreateObject("adodb.recordset")
sql="select top 1 lottery_num from fsd_info order by addtime desc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
if StrComp(rs("lottery_num"),qihao)<>0 and qihao<>"" and haoma<>"" then
sql = "insert into fsd_info(lottery_num,num_info1,num_info2,num_info3,addtime,kjtime) values('"&qihao&"','"&hm1&"','"&hm2&"','"&hm3&"','"&now()&"','"&kjsj&"')"
conn.execute(sql)
response.Redirect("chkwin.asp?lt=fsd&cp_num="&qihao&"")
end if
end if
set rs=nothing
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询