asp高手帮我看哈...谢谢了哈

来源:百度知道 编辑:UC知道 时间:2024/06/08 03:14:16
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/coon.asp" -->
<%
Dim xsmessage
Dim xsmessage_numRows

Set xsmessage = Server.CreateObject("ADODB.Recordset")
xsmessage.ActiveConnection = MM_coon_STRING
xsmessage.Source = "SELECT * FROM message"
xsmessage.CursorType = 0
xsmessage.CursorLocation = 2
xsmessage.LockType = 1
xsmessage.Open()

xsmessage_numRows = 0
%>

<table width="652" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="652" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="71"> 

从数据库中读出来的数据集,你只取了第一个,没有循环结构读下去,当然只显示第一条了.

我的做法为:
<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = MM_coon_STRING
rs.Source = "SELECT * FROM message"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

do while not rs.eof
%>

<table width="652" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="652" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="71"> </td>
<td width="581"><%=rs("Subject")%></td>
</tr>
<tr>
<td> </td>
<td><%=rs("Product")%></td>
</tr>
<tr>
<td> </td>
<td><%=rs("Da