2 lpirate4 lpirate4 于 2016.03.07 20:29 提问

关于动态网页设计的问题
 <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/testDatabase.asp" -->
<%
Dim conn
Dim conn_cmd
Dim conn_numRows

Set conn_cmd = Server.CreateObject ("ADODB.Command")
conn_cmd.ActiveConnection = MM_testDatabase_STRING
conn_cmd.CommandText = "SELECT * FROM 产品表 ORDER BY [产品ID] DESC" 
conn_cmd.Prepared = true

Set conn = conn_cmd.Execute
conn_numRows = 0
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_testDatabase_STRING
Recordset1_cmd.CommandText = "SELECT * FROM 产品表"
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
conn_numRows = conn_numRows + Repeat1__numRows
%>
<!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=utf-8" />
<title>无标题文档</title>
</head>

<body>
<p>使用SQL查询记录集</p>
<table border="1" cellpadding="1" cellspacing="1">
  <tr>
    <td>产品ID</td>
    <td>产品编码</td>
    <td>产品正面</td>
    <td>产品背面</td>
    <td>类别</td>
    <td>产品说明</td>
  </tr>
  <% While ((Repeat1__numRows <> 0) AND (NOT conn.EOF)) %>
    <tr>
      <td><%=(conn.Fields.Item("产品ID").Value)%></td>
      <td><%=(conn.Fields.Item("产品编码").Value)%></td>
      <td><%=(conn.Fields.Item("产品正面").Value)%></td>
      <td><%=(conn.Fields.Item("产品背面").Value)%></td>
      <td><%=(conn.Fields.Item("类别").Value)%></td>
      <td><%=(conn.Fields.Item("产品说明").Value)%></td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  conn.MoveNext()
Wend
%>
</table>
<p>绑定记录集:<%=(conn.Fields.Item("产品编码").Value)%></p>
</body>
</html>
<%
conn.Close()
Set conn = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

以下是出错信息:
Microsoft VBScript 编译器错误 '800a0409'

未结束的字符串常量

\index.asp, line 23
实在找不出哪里出错了,请大家指点一下。

2个回答

devmiao
devmiao   Ds   Rxr 2016.03.07 23:13
showbo
showbo   Ds   Rxr 2016.03.08 10:22

Recordset1_cmd.CommandText = "SELECT * FROM 产品表"

23是这个?字符串闭合了,是不是贴错代码了

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!