| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:ADODB.Recordset (0x800A0BB9) 错误
只看楼主 加入收藏
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
结帖率:85.71%
收藏
 问题点数:0 回复次数:5 
ADODB.Recordset (0x800A0BB9) 错误
<%
      dim  sql,student_id,student_name,age,sex,in_time,homeplace,major
      student_id=Trim(Request.Form("student_id"))
      student_name=Trim(Request.Form("student_name"))
      sex=Trim(Request.Form("sex"))
      age=Trim(Request.Form("age"))
      in_time=Trim(Request.Form("in_time"))
      homeplace=Trim(Request.Form("homeplace"))
      major=Trim(Request.Form("major"))
      set urs=Server.CreateObject("ADODB.Recordset")
      sql="select student_id,student_name,sex,age,in_time,homeplace,major from student where student_name='"&student_name&"'"
      urs.open sql,conn,1,3
      if not rs.eof  then
             response.Write"<script> alert('此学生已存在.')</script>;history.back();"
             response.End
     else
            set rs="nothing"
            set rs=Server.CreateObject("ADODB.Recordset")
            sql="Selcet student_id,student_name,sex,age,in_time,homeplace,major  from student"
            urs.open sql,conn,1,3// 第 12 行
            urs.addnew
            urs("student_id")=student_id
            urs("student_name")=student_name
            urs("sex")=sex
            urs("in_time")=in_time
            urs("homeplace")=homeplace
            urs("major")=major
            urs.update
            urs.close
            set urs=nothing
     end if
 
  set urs=nothing
  response.Write "<script language=javascript>{window.alert('记录添加成功!请点击“确定”');window.location.href='add_student.asp';}</script>"                        
%>
ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/biyesheji/admin/save.asp, 第 12 行
搜索更多相关主题的帖子: Recordset ADODB 
2010-05-19 14:51
fengmnll
Rank: 1
等 级:新手上路
帖 子:79
专家分:3
注 册:2008-11-6
收藏
得分:0 
麻烦大家看看为什么出错了,谢谢
2010-05-19 14:51
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
收藏
得分:0 
set rs=Server.CreateObject("ADODB.Recordset")
            sql="Selcet student_id,student_name,sex,age,in_time,homeplace,major  from student"
            urs.open sql,conn,1,3// 第 12 行
注意看2个红色字体对象一样吗?你建立的是rs对象,而操作上的却是urs

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-05-20 11:39
gupiao175
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:40
帖 子:1787
专家分:7527
注 册:2007-6-27
收藏
得分:0 
也许你会说上面已经建立了urs,但是2个查询根本不是同一回事!
建议下面的全部改为使用rs:
            set rs=Server.CreateObject("ADODB.Recordset")
            sql="Selcet * from student"
            rs.open sql,conn,1,3// 第 12 行
            rs.addnew
            rs("student_id")=student_id
            rs("student_name")=student_name
            rs("sex")=sex
            rs("in_time")=in_time
            rs("homeplace")=homeplace
            rs("major")=major
            rs.update
            rs.close
            set rs=nothing
并确保每个变量或字段对应数据库里都有值存在!

Q:1428196631,百度:开发地 即可找到我,有事请留言!
2010-05-20 11:46
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
你前面的是urs,、可后面却是:(注意红色标出的)
             if not rs.eof  then
             response.Write"<script> alert('此学生已存在.')</script>;history.back();"
             response.End

只有大胆尝试,才有机会得到想要的成功
2010-05-20 16:32
魏兴耀
Rank: 8Rank: 8
来 自:江西
等 级:蝙蝠侠
威 望:3
帖 子:246
专家分:840
注 册:2009-11-9
收藏
得分:0 
还有这里:  else
            set rs="nothing"
            set rs=Server.CreateObject("ADODB.Recordset")
            sql="Selcet student_id,student_name,sex,age,in_time,homeplace,major  from student"

只有大胆尝试,才有机会得到想要的成功
2010-05-20 16:32
快速回复:ADODB.Recordset (0x800A0BB9) 错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022486 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved