ACCESS连接,转换成SQL

xilaianzxsc 2013-04-15 04:53:00
由于必须使用SQL,但网上的例子一般用的都是ACCESS的,所以请高手帮忙转换下。希望写详细一点。在此,先向各位老师表示感谢。

<%
set adCn=Server.CreateObject("Adodb.Connection")
adCn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.MapPath("tree.mdb")
parentid=Request.QueryString("id")
set adRs=adCn.execute("select * ,(select count(*) from tree where parentid=subTree.id) as childNum from tree subTree where parentid=" & parentid)
Response.Write("<script>")
Response.Write("var tree=self.parent.tree;")
''加载第一级节点时,应设id为-1
if parentid="-1" then
Response.Write("var toNode=tree.root;")
else
''节点的键值已依次设成n1,n2,n3........
Response.Write("var toNode=tree.nodes['n" & parentid & "'];")
end if
while not adRs.EOF
'''如果icon字段不为空,图标取数据库的值,否则根据是否有子节点取"folder"或"file"。相应地imagelist应提供这两个键值的图标
if(adRs("icon")<>"") then
icon=adRs("icon")
elseif(adRs("childNum")=0) then
icon="file"
else
icon="folder"
end if
''输出添加节点的代码,第三个参数是设键值的
Response.Write "var nNode=tree.add(toNode,'last','" & adRs("text") & "','" & "n" & adRs("id") & "','" & icon & "','" & adRs("exeCategory") & "','" & adRs("exeArgv") & "');"
Response.Write "if(nNode.parent.first.label.innerText=='loading...')nNode.parent.first.remove();"
if(adRs("childNum")<>0) then
Response.Write "nNode.add('loading...');nNode.expand(false);"
end if
adRs.MoveNext
wend
Response.Write("</script>")
%>



以上是连接access的源码.


我的服务器上,有一个文件夹,里面,已经有一个文件:<!--#include file="Connections/TianShen.asp" -->

此文件内容如下: (通过此文件,可以正常访问到SQL)

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_TianShen_STRING
MM_TianShen_STRING = "dsn=TianShen;uid=sa;"
%>



由于是初学,请各老师,不要笑话我水平低.

再次,向各位老师,表示谢意.


...全文
6189 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
u010331720 2013-04-17
  • 打赏
  • 举报
回复
新手路过
xilaianzxsc 2013-04-17
  • 打赏
  • 举报
回复
无人回复,我只好自己研究.
xilaianzxsc 2013-04-17
  • 打赏
  • 举报
回复
别看代码长,其实,我只需要链接调整的那部分
xilaianzxsc 2013-04-17
  • 打赏
  • 举报
回复
还是无人回复,我就继续等
xilaianzxsc 2013-04-16
  • 打赏
  • 举报
回复
盼复中.........

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧