首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

添加删除命令时,出现异常ADODB.Command (0x800A0D5D)

2012-05-21 
添加删除命令时,出现错误ADODB.Command (0x800A0D5D)请尝试执行下列操作:单击刷新按钮,或稍后重试。打开 lo

添加删除命令时,出现错误ADODB.Command (0x800A0D5D)
请尝试执行下列操作:

单击刷新按钮,或稍后重试。

打开 localhost 主页,然后查找与所需信息相关的链接。 
HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------

技术信息(用于支持人员)

错误类型:
ADODB.Command (0x800A0D5D)
应用程序在当前操作中使用了错误类型的值。
/admin_ht/ly_gl.asp, 第 30 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) 

网页:
GET /admin_ht/ly_gl.asp 

时间:
2012年5月17日, 15:37:14 


详细信息:
Microsoft 支持 



以下是本页全代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
  MM_IIf = ifFalse
  Else
  MM_IIf = ifTrue
  End If
End Function
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_cmd.CommandText = "SELECT * FROM liuyan_biao ORDER BY lytime DESC" 
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%

Set Command1 = Server.CreateObject ("ADODB.Command")
Command1.ActiveConnection = MM_conn_STRING
Command1.CommandText = "DELETE FROM liuyan_biao WHERE lyid = ?"
Command1.Parameters.Append Command1.CreateParameter("a", 3, 1, -1, MM_IIF(request("lyid"), request("lyid"), Command1__a & "")) 这是出错行!
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last

' set the record count
Recordset1_total = Recordset1.RecordCount

' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If

' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
  Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
  Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
  Recordset1_numRows = Recordset1_total
  End If
End If
%>

<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (Recordset1_total = -1) Then

  ' count the total records by iterating through the recordset
  Recordset1_total=0
  While (Not Recordset1.EOF)
  Recordset1_total = Recordset1_total + 1
  Recordset1.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
  Else
  Recordset1.Requery
  End If

  ' set the number of rows displayed on this page


  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
  Recordset1_numRows = Recordset1_total
  End If

  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  
  If (Recordset1_first > Recordset1_total) Then
  Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
  Recordset1_last = Recordset1_total
  End If

End If
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style></head>

<body>
<h3><a href="ly_gl.asp">留言管理</a></h3>
<p>&nbsp;</p>
<table width="100%" border="1" cellspacing="0" cellpadding="6">
  <tr align="center">
  <td colspan="8"><strong>管理现有留言(共<%=(Recordset1_total)%>条留言)</strong></td>
  </tr>
  <tr align="center">
  <td align="center"><strong>姓名</strong></td>
  <td align="center"><strong>联系电话</strong></td>
  <td align="center"><strong>留言内容</strong></td>
  <td align="center"><strong>联系地址</strong></td>
  <td align="center"><strong>审核</strong></td>
  <td align="center"><strong>回复</strong></td>
  <td align="center"><strong>修改</strong></td>
  <td align="center"><strong>删除</strong></td>
  </tr>
  <% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
  <tr>
  <td align="center"><%=(Recordset1.Fields.Item("lyxm").Value)%></td>
  <td align="center"><%=(Recordset1.Fields.Item("lxdh").Value)%></td>
  <td align="center"><%=(Recordset1.Fields.Item("lynr").Value)%></td>
  <td align="center"><%=(Recordset1.Fields.Item("lxdz").Value)%></td>
  <td align="center"><%=(Recordset1.Fields.Item("sh").Value)%></td>
  <td align="center">回复</td>
  <td align="center">修改</td>
  <td align="center"><a href="ly_gl.asp?type=del&amp;lyid=<%=(Recordset1.Fields.Item("lyid").Value)%>">删除</a></td>
  </tr>
  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


[解决办法]
Command1.Parameters.Append Command1.CreateParameter("a", 3, 1, -1, MM_IIF(request("lyid"), request("lyid"), Command1__a & ""))


分别看看你传的参数对不对。。
[解决办法]
CreateParameter 里指定3,说明是整型,MM_IIf里返回的是字符串。要做类型转换
CInt(MM_IIf(request("lyid"),request("lyid"), 0))

----
Command1__a是什么?
[解决办法]
Command1.CreateParameter("a", 3, 1, -1, CINT(MM_IIF(request("lyid"), request("lyid"),0))
[解决办法]
参数不对,或者重新建立网页

热点排行