CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

十万火急!菜鸟问题,高分回报!有关ASP与ACCESS数据库连接。。。。(在线等待)

楼主SUPERHANDY(湖里糊徒)2002-09-24 08:44:05 在 Web 开发 / ASP 提问

<%  
   
  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")   %>&nbsp;</td>  
              <td><%   =custmoterlist("sfbz")   %>&nbsp;</td>  
              <td><%     =custmoterlist("sffw")     %>&nbsp;</td>  
              <td><%   =custmoterlist("sfyj")       %>&nbsp;</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")   %>&nbsp;</td>  
              <td><%   =custmoterlist("sfbz")   %>&nbsp;</td>  
              <td><%     =custmoterlist("sffw")     %>&nbsp;</td>  
              <td><%   =custmoterlist("sfyj")       %>&nbsp;</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")   %>&nbsp;</td>  
              <td><%   =custmoterlist("sfbz")   %>&nbsp;</td>  
              <td><%     =custmoterlist("sffw")     %>&nbsp;</td>  
              <td><%   =custmoterlist("sfyj")       %>&nbsp;</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")   %>&nbsp;</td>  
              <td><%   =custmoterlist("sfbz")   %>&nbsp;</td>  
              <td><%     =custmoterlist("sffw")     %>&nbsp;</td>  
              <td><%   =custmoterlist("sfyj")       %>&nbsp;</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

相关问题

  • 十万火急,数据库起不来
  • 十万火急:关于ACCESS2000数据库
  • 十万火急!加密的数据库忘了密码!!!
  • 十万火急!!!怎样用jdbc连接db2数据库
  • 十万火急!!!!数据库高手请进!!!抢分区??????
  • 十万火急!!数据库被标志为:emergency mode !!!!!!!
  • 紧急求助:如何恢复此数据库?(十万火急!!!)
  • 如何对SYBASE数据库做日常备份,十万火急
  • 十万火急!!!用ADO如何连接Sybase数据库?
  • 十万火急,一个特简单的vc数据库问题

关键词

  • 收费
  • 项目
  • access
  • microsoft
  • server
  • rsf
  • strconnection
  • 依据
  • mdb
  • dbq

得分解答快速导航

  • 帖主:SUPERHANDY
  • flashasp
  • Chinatosun
  • uusong
  • abigfrog

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo