⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read.asp

📁 ajax+asp的留言簿
💻 ASP
字号:
<%
option explicit
'========错误返回列表==========
'1:idcode参数不正确
'2:数据不存在
dim xml:xml="<?xml version='1.0' encoding='gb2312'?>"&vbnewline
xml=xml&"<body>"&vbnewline
dim idcode:idcode=request.QueryString("idcode")&""
if idcode="" or not isnumeric(idcode) or len(idcode)<>6 then
 xml=xml&"<errcode>1</errcode>"&vbnewline 
 call writeXML
end if
dim pid,cid,lid
call splitIdCode
dim cn,rs,connstr,sql
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("db.mdb")
set cn=server.CreateObject("adodb.connection")
sql="select proname from pro where pid="&pid'省
cn.Open connstr
set rs=cn.Execute(sql)
if rs.bof and rs.eof then
 xml=xml&"<errcode>2</errcode>"&vbnewline
 rs.close
 set rs=nothing
 call releaseDB
 call writeXML
end if
xml=xml&"<info>"&vbnewline
xml=xml&"<p><![CDATA["&rs(0)&"]]></p>"&vbnewline 
rs.close
sql="select cityname from city where pid="&pid&" and cid="&cid'市
set rs=cn.Execute(sql)
if rs.bof and rs.eof then
  xml=xml&"<c><![CDATA[]]></c>"&vbnewline
else
 xml=xml&"<c><![CDATA["&rs(0)&"]]></c>"&vbnewline 
end if
rs.close
sql="select locationname from location where pid="&pid&" and cid="&cid&" and lid="&lid'区
set rs=cn.Execute(sql)
if rs.bof and rs.eof then
  xml=xml&"<l><![CDATA[]]></l>"&vbnewline
else
 xml=xml&"<l><![CDATA["&rs(0)&"]]></l>"&vbnewline 
end if
xml=xml&"</info>"&vbnewline
rs.close
set rs=nothing
call releaseDB
call writeXML

sub splitIdCode
 pid=cint(left(idcode,2))
 cid=cint(mid(idcode,3,2))
 lid=cint(right(idcode,2))
end sub

sub releaseDB
  cn.Close
  set cn=nothing
end sub

sub writeXML
  xml=xml&"</body>"'完成标记
  response.Clear
  response.CharSet="gb2312"
  response.ContentType="text/xml"
  response.Write xml
  response.End
end sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -