求救:把sql server 2000与Dreamweaver连接后,浏览网页会提示错误,如下所示:
错误类型:
ADODB.Field (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/xiugai.asp, 第 124 行我的代码:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/xinwen.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("newsid") <> "") Then 
  Recordset1__MMColParam = Request.QueryString("newsid")
End If
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the update
    Dim MM_editCmd    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_xinwen_STRING
    MM_editCmd.CommandText = "UPDATE dbo.[new] SET newsid = ?, newstitle = ?, newscontent = ?, newstime = ? WHERE newsid =" & Request.Form("MM_recordId")  
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, -1, Request.Form("newsid")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, -1, Request.Form("newstitle")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, -1, Request.Form("newscontent")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 135, 1, -1, MM_IIF(Request.Form("newstime"), Request.Form("newstime"), null)) ' adDBTimeStamp
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "xwguanli.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="houtai.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRowsSet Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_xinwen_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.new WHERE newsid = ?" 
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 10, Recordset1__MMColParam) ' adVarCharSet Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%><html>
<head>
<title>企业网站</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.STYLE2 {font-size: 14px}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (index.psd) -->
<table width="780" height="853" border="0" align="center" cellpadding="0" cellspacing="0" id="__01">
<tr>
<td colspan="5">
<img src="images/index_01.jpg" width="780" height="1" alt=""></td>
</tr>
<tr>
<td colspan="5">
<img src="images/index_02.jpg" alt="" width="780"></td>
</tr>
<tr>
<td colspan="2">
<img src="images/index_03.jpg" width="198" height="1" alt=""></td>
<td width="550" rowspan="5" valign="top">&nbsp;
          <form method="post" action="<%=MM_editAction%>" name="form1">
            <table align="center">
              <tr valign="baseline">
                <td nowrap align="right"><span class="STYLE2">编号:</span></td>
                <td><input type="text" name="newsid" value="<%=(Recordset1.Fields.Item("newsid").Value)%>" size="32">                </td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right"><span class="STYLE2">标题:</span></td>
                <td><input type="text" name="newstitle" value="<%=(Recordset1.Fields.Item("newstitle").Value)%>" size="32">
                </td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right"><span class="STYLE2">内容:</span></td>
                <td><textarea name="newscontent" cols="60" rows="12"><%=(Recordset1.Fields.Item("newscontent").Value)%></textarea>
                </td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right"><span class="STYLE2">时间:</span></td>
                <td><input type="text" name="newstime" value="<%=(Recordset1.Fields.Item("newstime").Value)%>" size="32">
                </td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td><input type="submit" value="更新记录">
                </td>
              </tr>
            </table>
            <input type="hidden" name="MM_update" value="form1">
            <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("newsid").Value %>">
          </form>
        <p>&nbsp;</p></td>
  <td colspan="2">
<img src="images/index_05.jpg" width="32" height="1" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_06.jpg" width="197" height="63" alt=""></td>
<td>
<img src="images/index_07.jpg" width="1" height="63" alt=""></td>
<td rowspan="4">
<img src="images/index_08.jpg" width="1" height="582" alt=""></td>
<td rowspan="4">
<img src="images/index_09.jpg" width="31" height="582" alt=""></td>
</tr>
<tr>
<td colspan="2"><img src="images/index_10.jpg" width="198" height="77" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="images/index_11.jpg" width="198" height="91" alt=""></td>
</tr>
<tr>
<td>
<img src="images/index_12.jpg" width="197" height="351" alt=""></td>
<td>
<img src="images/index_13.jpg" width="1" height="351" alt=""></td>
</tr>
<tr>
<td colspan="5">
<img src="images/index_14.jpg" width="780" height="109" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>上面红色字体的就是第124行。

解决方案 »

  1.   

    刚好在网上看到一篇文章,原来我提得问题是DW做ASP程序时关于数据库的常见问题。ADODB.Field (0x800A0BCD)BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。  
        这种错误常产生于网页之间传递数据.我们知道ASP应用程序时一般至少拥有二个或二个以上的Web页面,这时就得考虑在多个Web页面间传递数据的处理工作。网页间数据传递的常用方法有:URL方式、FORM方式、COOKIE、APPLICATION、SESSION。其中URL方式和form方式实现方法简单,可实现网页间的简单数据传递(也是我们初学者能快速掌握的)而且必须是连续访问两页面间数据传递。如在制作网站搜索引擎时,便要用到FORM方式传递参数。又如我们每每看一些网站在用户注册后,便可在下一个页面看出到用户的详细信息。但我们用DW制作类似的页面时则总出现这样的错误。这样的错误一般属于记录集(recordset)的问题.这类问题发生的原因,一般是执行了查询条件,但送回的结果却是空的,即没有符合查询条件的记录或是执行了循环,执行到第一个或是最后一个记录集的时候,没有及时终止循环,所以产生了错误。
         解决此问题就要用到网页间的数据传递,可用FORM参数、URL参数或阶段变量(如SESSION)来决定查询条件。
         这个给我很多启迪。
      

  2.   

    建议用Dreamweaver做页面,用vs做开发!