韦永丽的生活这照:asp的动态文本无法显示

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 05:47:58
各位高手:我正在建数据库,但每次设置动态表格时,本地测试结果不是只显示一条记录就是提示错误,提示如下
错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: ''
/index.asp, 第 6 行

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

代码为:
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td>kzwm</td>
<td>kldm</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
<tr>
<td><%=(Recordset1.Fields.Item("kzwm").Value)%></td>
<td><%=(Recordset1.Fields.Item("kldm").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
<!--#include file="Connections/sjk.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
Recordset1__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_sjk_STRING
Recordset1.Source = "SELECT kzwm, kldm FROM list WHERE ID = " + Replace(Recordset1__MMColParam, "'", "''") + " ORDER BY ID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

请各位高手指点,小弟不胜感激!!!
按照2楼说的放到<table border="1" cellpadding="5" cellspacing="0"> 没有用,放到前面倒是可以,但是还是只能显示一条记录,而且绑定的记录集也消失了

连接方式不对,在桌面上新建一个文本文档,把扩展名改成*.udl,双击进入,在“提供程序”选项卡里选Jet4.0 OLE DB Provider,再指定你的数据库路径,试试看



<!--#include file="Connections/sjk.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
Recordset1__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_sjk_STRING
Recordset1.Source = "SELECT kzwm, kldm FROM list WHERE ID = " + Replace(Recordset1__MMColParam, "'", "''") + " ORDER BY ID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>

放到

<table border="1" cellpadding="5" cellspacing="0">

的前面就正常了。
ASP是顺序执行代码。