十万火急!菜鸟问题,高分回报!有关ASP与ACCESS数据库连接。。。。(在线等待)
<%
conn="DBQ="+server.MapPath("customer.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set strconnection=server.createobject("ADODB.CONNECTION")
strconnection.open conn
SQL="select * from SCHOOL Order By ID DESC"
SET CustomerList=strconnection.EXECUTE(SQL)
%>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:89px; height:55px; z-index:1"><img src="images/newjpg/form.jpg" width="800" height="600"></div>
<div id="Layer2" style="position:absolute; left:125px; top:25px; width:563px; height:51px; z-index:2">
<table width="546" height="38" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="65" height="18">类别</td>
<td width="127">收费项目</td>
<td width="148">收费标准</td>
<td width="111">收费范围</td>
<td width="315">收费依据</td>
</tr>
<% do while not customerlist.eof
%>
<tr>
<td height="18"><% =custmoterlist("LB") %></td>
<td><% =custmoterlist("sfxm") %> </td>
<td><% =custmoterlist("sfbz") %> </td>
<td><% =custmoterlist("sffw") %> </td>
<td><% =custmoterlist("sfyj") %> </td>
</tr>
<%
custmoterlist.movenext
loop
%>
</table>
</div>
运行怎么也通不过。。。。。帮忙!!!帮忙!!!
问题点数:80、回复次数:11Top
1 楼flashasp(flashasp)回复于 2002-09-24 08:47:33 得分 10
DbPath = SERVER.MapPath("customer.mdb")
Set strconnection = Server.CreateObject("ADODB.Connection")
strconnection.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath
SQL="select * from SCHOOL Order By ID DESC"
SET CustomerList=strconnection.EXECUTE(SQL)Top
2 楼abigfrog(千年精灵)(★JAVA★)回复于 2002-09-24 08:51:56 得分 0
<%
on error resume next
conn="DBQ="+server.MapPath("customer.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set strconnection=server.createobject("ADODB.CONNECTION")
strconnection.open conn
%>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:89px; height:55px; z-index:1"><img src="images/newjpg/form.jpg" width="800" height="600"></div>
<div id="Layer2" style="position:absolute; left:125px; top:25px; width:563px; height:51px; z-index:2">
<table width="546" height="38" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="65" height="18">类别</td>
<td width="127">收费项目</td>
<td width="148">收费标准</td>
<td width="111">收费范围</td>
<td width="315">收费依据</td>
</tr>
<%
SQL="select * from SCHOOL Order By ID DESC"
SET CustomerList=strconnection.EXECUTE(SQL)
if not CustomerList.bof and CustomerList.eof then
do while not CustomerList.eof
%>
<tr>
<td height="18"><% =custmoterlist("LB") %></td>
<td><% =custmoterlist("sfxm") %> </td>
<td><% =custmoterlist("sfbz") %> </td>
<td><% =custmoterlist("sffw") %> </td>
<td><% =custmoterlist("sfyj") %> </td>
</tr>
<%
CustomerList.movenext
loop
else
response.write ("no data selected!")
end if
if err.number<>0 then
response.write err.description
err.clear
end if
%>
</table>
</div>
Top
3 楼SUPERHANDY(湖里糊徒)回复于 2002-09-24 08:53:38 得分 0
strconnection.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath
运行时还是报错!!! 我也不知道错在哪里?
Top
4 楼abigfrog(千年精灵)(★JAVA★)回复于 2002-09-24 08:53:50 得分 0
<%
on error resume next
conn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="&Server.MapPath("customer.mdb")
set strconnection=server.createobject("ADODB.CONNECTION")
strconnection.open conn
%>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:89px; height:55px; z-index:1"><img src="images/newjpg/form.jpg" width="800" height="600"></div>
<div id="Layer2" style="position:absolute; left:125px; top:25px; width:563px; height:51px; z-index:2">
<table width="546" height="38" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="65" height="18">类别</td>
<td width="127">收费项目</td>
<td width="148">收费标准</td>
<td width="111">收费范围</td>
<td width="315">收费依据</td>
</tr>
<%
SQL="select * from SCHOOL Order By ID DESC"
SET CustomerList=strconnection.EXECUTE(SQL)
if not CustomerList.bof and CustomerList.eof then
do while not CustomerList.eof
%>
<tr>
<td height="18"><% =custmoterlist("LB") %></td>
<td><% =custmoterlist("sfxm") %> </td>
<td><% =custmoterlist("sfbz") %> </td>
<td><% =custmoterlist("sffw") %> </td>
<td><% =custmoterlist("sfyj") %> </td>
</tr>
<%
CustomerList.movenext
loop
else
response.write ("no data selected!")
end if
if err.number<>0 then
response.write err.description
err.clear
end if
%>
</table>
</div>
Top
5 楼chxzll(小气包)回复于 2002-09-24 08:56:32 得分 0
顺便提个建议,常规用法,用conn被赋值Server.CreateObject("ADODB.CONNECTION"),而connstr赋予数据库的参数Top
6 楼Chinatosun(继续努力 UML系统分析 )回复于 2002-09-24 08:57:25 得分 10
<%
dim conn
set conn=server.createobject("adodb.connection")
conn.connectionstring="driver={microsoft access driver (*.mdb)};"&"dbq="&server.mappath("customer.mdb")
conn.open
dim CustomerList
set CustomerList=server.createobject("adodb.recordset")
CustomerList.open "select * from SCHOOL Order By [ID] DESC",conn,1,3
%>
好了,游标方式你根据需要自己改就是了!
用完了,注意释放对象。Top
7 楼SUPERHANDY(湖里糊徒)回复于 2002-09-24 09:02:08 得分 0
8 (0x00000008)
机器说程序发生异常,还说虚拟内存不够,并返回上面的值!Top
8 楼abigfrog(千年精灵)(★JAVA★)回复于 2002-09-24 09:03:56 得分 0
运行我给你的程序了么?Top
9 楼SUPERHANDY(湖里糊徒)回复于 2002-09-24 09:06:17 得分 0
是呀,可是机器变得特别的慢。。。。Top
10 楼uusong(断情僧)回复于 2002-09-24 09:14:54 得分 30
dim conn
dim connstr
connstr="DBQ="+server.mappath("yourdb.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
dim rsf,sql
sql="select * from school order by id desc"
set rsf=server.createobject("adodb.recordset")
rsf.open sql,conn,1,1
do while not rsf.eof
response.write rsf("id")
.....
rsf.movenext
loop
conn.close
rsf.close
set conn=nothing
set rsf=nothing
试试吧,应该没问题!
Top
11 楼abigfrog(千年精灵)(★JAVA★)回复于 2002-09-24 09:16:25 得分 30
如果再不行,重启IIS
<%
'on error resume next
conn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ="&Server.MapPath("customer.mdb")
set strconnection=server.createobject("ADODB.CONNECTION")
strconnection.open conn
%>
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:89px; height:55px; z-index:1"><img src="images/newjpg/form.jpg" width="800" height="600"></div>
<div id="Layer2" style="position:absolute; left:125px; top:25px; width:563px; height:51px; z-index:2">
<table width="546" height="38" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="65" height="18">类别</td>
<td width="127">收费项目</td>
<td width="148">收费标准</td>
<td width="111">收费范围</td>
<td width="315">收费依据</td>
</tr>
<%
SQL="select * from SCHOOL Order By ID DESC"
SET CustomerList=strconnection.EXECUTE(SQL)
if not CustomerList.bof and CustomerList.eof then
do while not CustomerList.eof
%>
<tr>
<td height="18"><% =custmoterlist("LB") %></td>
<td><% =custmoterlist("sfxm") %> </td>
<td><% =custmoterlist("sfbz") %> </td>
<td><% =custmoterlist("sffw") %> </td>
<td><% =custmoterlist("sfyj") %> </td>
</tr>
<%
CustomerList.movenext
loop
else
response.write ("no data selected!")
end if
if err.number<>0 then
response.write err.description
err.clear
end if
%>
</table>
</div>
Top




