CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

急问::ASP 连接数据库发生异常,说是数据源名称过长

楼主cqluojia(人狼)2004-08-03 14:42:51 在 Web 开发 / ASP 提问

如题,请各位老大给点解决方案.    
  login.asp源代码如下:  
  <%@LANGUAGE="VBSCRIPT"   CODEPAGE="936"%>  
  <!--#include   file="Connections/ConnDB.asp"   -->  
  <%  
  '   ***   Validate   request   to   log   in   to   this   site.  
  MM_LoginAction   =   Request.ServerVariables("URL")  
  If   Request.QueryString<>""   Then   MM_LoginAction   =   MM_LoginAction   +   "?"   +   Request.QueryString  
  MM_valUsername=CStr(Request.Form("AdminName"))  
  If   MM_valUsername   <>   ""   Then  
      MM_fldUserAuthorization="AdminLevel"  
      MM_redirectLoginSuccess="admin.asp"  
      MM_redirectLoginFailed="admin.asp?login=false"  
      MM_flag="ADODB.Recordset"  
      set   MM_rsUser   =   Server.CreateObject(MM_flag)  
      MM_rsUser.ActiveConnection   =   MM_ConnDB_STRING  
      MM_rsUser.Source   =   "SELECT   AdminName,   AdminPassword"  
      If   MM_fldUserAuthorization   <>   ""   Then   MM_rsUser.Source   =   MM_rsUser.Source   &   ","   &   MM_fldUserAuthorization  
      MM_rsUser.Source   =   MM_rsUser.Source   &   "   FROM   admin   WHERE   AdminName='"   &   Replace(MM_valUsername,"'","''")   &"'   AND   AdminPassword='"   &   Replace(Request.Form("AdminPWD"),"'","''")   &   "'"  
      MM_rsUser.CursorType   =   0  
      MM_rsUser.CursorLocation   =   2  
      MM_rsUser.LockType   =   3  
      MM_rsUser.Open  
      If   Not   MM_rsUser.EOF   Or   Not   MM_rsUser.BOF   Then    
          '   username   and   password   match   -   this   is   a   valid   user  
          Session("MM_Username")   =   MM_valUsername  
          If   (MM_fldUserAuthorization   <>   "")   Then  
              Session("MM_UserAuthorization")   =   CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)  
          Else  
              Session("MM_UserAuthorization")   =   ""  
          End   If  
          if   CStr(Request.QueryString("accessdenied"))   <>   ""   And   false   Then  
              MM_redirectLoginSuccess   =   Request.QueryString("accessdenied")  
          End   If  
          MM_rsUser.Close  
          Response.Redirect(MM_redirectLoginSuccess)  
      End   If  
      MM_rsUser.Close  
      Response.Redirect(MM_redirectLoginFailed)  
  End   If  
  %>  
  <html>  
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>管理员界面</title>  
  <script   language="JavaScript"   type="text/javascript">  
  <!--  
  function   PageLoad(){  
  <%  
  Select   Case   Request.QueryString("login")  
      Case   "false"  
      Response.Write("alert(""管理员帐号或者密码错误!登录失败,请重新输入!\t"");")  
      Case   "denied"  
      Response.Write("alert(""禁止匿名访问!请您输入管理员帐号和密码登录!\t"");")  
  End   Select  
  %>  
      Login.AdminName.focus();  
  }  
  //-->  
  </script>  
  <link   href="login.css"   rel="stylesheet"   type="text/css">  
  </head>  
   
  <body   bgcolor="#EEEEEE"   onLoad="PageLoad();">  
  <table   width="100%"   height="100%"   border="0"   cellpadding="3"   cellspacing="0">  
      <tr>  
          <td><form   action="<%=MM_LoginAction%>"   method="POST"   name="Login"   id="Login">  
          <table   border="0"   align="center"   cellpadding="3"   cellspacing="1"   bgcolor="#336699">  
              <tr   align="center"   bgcolor="#0099CC">  
                  <td   height="32"   bgcolor="#466FCB"   class="font14px"><strong><font   color="#FFFFFF">管理员登录</font></strong></td>  
              </tr>  
              <tr>  
                  <td   align="center"   bgcolor="#FFFFFF"><table   width="400"   border="0"   cellspacing="0"   cellpadding="5">  
                          <tr>  
                              <td   width="35%"   align="right">管理员帐号:</td>  
                              <td   width="65%"><input   name="AdminName"   type="text"   class="inputbox"   id="AdminName"   size="32"></td>  
                          </tr>  
                          <tr>  
                              <td   align="right">管理员密码:</td>  
                              <td><input   name="AdminPWD"   type="password"   class="inputbox"   id="AdminPWD"   size="32"></td>  
                          </tr>  
                          <tr>  
                              <td>&nbsp;</td>  
                              <td   align="center">&nbsp;&nbsp;  
                                  <input   name="Submit"   type="submit"   class="button"   value="登   录">  
  &nbsp;&nbsp;&nbsp;  
  <input   name="Reset"   type="reset"   class="button"   id="Reset"   value="重   置">  
                              </td>  
                          </tr>  
                      </table>  
                  </td>  
              </tr>  
          </table>  
          </form>  
          </td>  
      </tr>  
  </table>  
  </body>  
  </html>  
   
  conndb.asp   源代码如下  
  <%  
  '   FileName="Connection_ado_conn_string.htm"  
  '   Type="ADO"    
  '   DesigntimeType="ADO"  
  '   HTTP="false"  
  '   Catalog=""  
  '   Schema=""  
   
  Dim   MM_ConnDB_STRING  
   
   
  MM_ConnDB_STRING=   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source="   &   Server.Mappath("database\#anpelsdb.mdb")  
   
  %> 问题点数:50、回复次数:5Top

1 楼cqluojia(人狼)回复于 2004-08-03 14:44:52 得分 0

错误信息如下:  
   
  Vbscript   Runtime   error   'ASP   0185   :   3219'  
  [Microsoft][ODBC   驱动程序管理器]   数据源名称过长    
   
  /login.asp,line   14    
   
  Top

2 楼yufeiyxl(与飞)回复于 2004-08-03 15:00:43 得分 50

现在访问数据库不需要专门建立数据源  
  给你一个常用的简单链接  
  <%  
  Dim   rs,conn,strsql,database,dbpath  
   
  database=1                 '设置使用的数据库类型,1=SQL   SERVER,其他为ACCESS  
   
  If   database=1   then  
  strsql="driver={SQL   Server};server=localhost;uid=sa;pwd=;database=fdc"  
  Else  
  dbpath=server.mappath("fdc.asa")  
  strsql="DBQ="+dbpath+";DRIVER={Microsoft   Access   Driver   (*.mdb)};"  
  End   if  
  Set   conn=server.createobject("adodb.connection")  
  conn.open   strsql  
  %>Top

3 楼yizia(椅子)回复于 2004-08-03 15:05:32 得分 0

在MM_rsUser.Open之前一行,把source输出,放到数据库里去调试一下Top

4 楼seesea125(执著)回复于 2004-08-03 15:08:24 得分 0

建立数据源  
  太古老,支持yufeiyxl(与飞)   (Top

5 楼cqluojia(人狼)回复于 2004-08-03 15:52:11 得分 0

不懂哦,大哥,可以说详细点吗??Top

相关问题

  • asp 数据库
  • ASP与数据库
  • ASP+SQL数据库
  • asp连数据库
  • asp连接数据库
  • asp的数据库问题
  • asp中数据库问题!
  • asp数据库问题,help~
  • asp调用数据库(acess2000)
  • asp连接数据库

关键词

  • 管理员
  • login

得分解答快速导航

  • 帖主:cqluojia
  • yufeiyxl

相关链接

  • Web开发类图书

广告也精彩

反馈

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