当前位置:StudyEZ>学易考试社区>IT>艺术设计>ASP问题求助

ASP问题求助

上一主题 下一主题
1页, 共1页 (共1楼)

ASP问题求助

2007-02-14 5:14 下午
运行下边代码老是说
变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。错误的是红色的那行,到底是什么错误啊?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="sg.asp" -->

<%
Dim s1
Dim s2
Set s1 = Server.CreateObject("ADODB.Recordset")
s2="select * from 1"
s1.open s2,conn,1,3

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body> <select name="姓名" id="年龄">
           <%s1.movefirst
  while(not s1.eof)
%>
          <option value="<%=s1("电话")%>"><%=s1("电话")%></option>
           <%
s1.movenext()
wend
%>
           </select>
</body>
</html>
<%
s1.Close()
Set s1 = Nothing
%>


这是另一格式,这个可以运行:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="sg.asp" -->

<%
Dim s1
Dim s1_numRows

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

s1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body> <select name="姓名" id="年龄">
           <%s1.movefirst
  while(not s1.eof)
%>
          <option value="<%=s1("电话")%>"><%=s1("电话")%></option>
           <%
s1.movenext()
wend
%>
           </select>

</body>
</html>
<%
s1.Close()
Set s1 = Nothing
%>
这两个不是一样效果吗?一个是简写而也,我把conn后边的数字换了好几个都不行 还是一样的错误?怎么回事啊?我用的ACCESS
60.12.9.222
1页, 共1页 (共1帖)