请教!问题所在

eva006 2004-11-14 03:09:53
<HTML>
<Title>寻找用户数据</Title>
<Body BgColor=#ffaaff>
<Form Name=FormGet1 Method=Post Action="Ch11_11.asp">
<FieldSet>
<Legend>请输入用户名:</Legend>
书号:<Input type="text" name="xm" Size=10> <p>
<Input type="Submit" Value="送出"> <p>
</FieldSet>
</Form>
</Body>
</HTML>
<%
Set DBconnection = Server.CreateObject("ADODB.Connection")
ConnectionString = "Driver={SQL Server};Server=ETERNAL;Database=gongsi;Uid=sa;Pwd=263501"
DBConnection.open ConnectionString
Set RS=Server.CreateObject("ADODB.Recordset")
RS.open "yh",BDConnection,1,2
if Request("xm") <> Empty then
condition="用户名:'" & Request("xm") & "'"
RS.Find = Condition
if RS.EOF then
Response.Write"很抱歉,查无此用户" & Request("xm") & "的数据"
else
Response.Write"查到的用户数据如下:<br><font Size=10 Color=blue>"
for i=0 to RS.Field.Count-1
Response.Write RS(i) & "<Br>"
next
Response.Write"</font>"
end if
end if
%>

运行时出现ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/Ch11_11.asp, 第 18 行
不知道哪里有误,请教各位高手!
...全文
118 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
comstep 2004-12-15
  • 打赏
  • 举报
回复
Set RS=Server.CreateObject("ADODB.Recordset")
RS.open condition,BDConnection,1,1
eva006 2004-11-14
  • 打赏
  • 举报
回复
还有一句错误信息有没有关系?
POST Data:
xm=%D0%BB%BF%AD
eva006 2004-11-14
  • 打赏
  • 举报
回复
已经试过数据库连接没有问题,你这个方法已经试过不行的
comstep 2004-11-14
  • 打赏
  • 举报
回复
那就是数据库连接出错了,仔细检查代码吧。
sql语句:
select * from 表名 where 列名='内容'
如果你的数据表名为table,其中要查询的字段名为xm,
如果xm是字符类型的,sql语句为:
conndition="select * from table where xm='"&request("xm")&"'"
如果xm为数字型的,sql语句这样写:

conndition="select * from table where xm="&request("xm")
eva006 2004-11-14
  • 打赏
  • 举报
回复
出现同样错误
comstep 2004-11-14
  • 打赏
  • 举报
回复

for i=0 to RS.Field.Count-1
Response.Write RS(i) & "<Br>"
next
改为:
do while not rs.eof
Response.Write (RS("xm") & "<Br>")
rs.movenext
loop
eva006 2004-11-14
  • 打赏
  • 举报
回复
楼上问题同样存在ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/Ch11_11.asp, 第 18 行
应该是SQL语句问题
comstep 2004-11-14
  • 打赏
  • 举报
回复
不好意思,成乱码了。
<HTML>
<Title>寻找用户数据</Title>
<Body BgColor=#ffaaff>
<Form Name=FormGet1 Method=Post Action="Ch11_11.asp">
<FieldSet>
<Legend>请输入用户名:</Legend>
书号:<Input type="text" name="xm" Size=10> <p>
<Input type="Submit" Value="送出"> <p>
</FieldSet>
</Form>
</Body>
</HTML>
<%
Set DBconnection = Server.CreateObject("ADODB.Connection")
ConnectionString = "Driver={SQL Server};Server=ETERNAL;Database=gongsi;Uid=sa;Pwd=263501"
DBConnection.open ConnectionString
if Request("xm") <> Empty then
condition="select * from yb where xm='" & Request("xm") & "'"
Set RS=Server.CreateObject("ADODB.Recordset")
RS.open condition,BDConnection,1,2
if RS.EOF then
Response.Write"很抱歉,查无此用户" & Request("xm") & "的数据"
else
Response.Write"查到的用户数据如下:<br><font Size=10 Color=blue>"
for i=0 to RS.Field.Count-1
Response.Write RS(i) & "<Br>"
next
Response.Write"</font>"
end if
end if
%>
777dragon 2004-11-14
  • 打赏
  • 举报
回复
RS.open "yh",BDConnection,1,2

?
comstep 2004-11-14
  • 打赏
  • 举报
回复
<HTML>
<Title>Ñ°ÕÒÓû§Êý¾Ý</Title>
<Body BgColor=#ffaaff>
<Form Name=FormGet1 Method=Post Action="Ch11_11.asp">
<FieldSet>
<Legend>ÇëÊäÈëÓû§Ãû£º</Legend>
ÊéºÅ£º<Input type="text" name="xm" Size=10> <p>
<Input type="Submit" Value="Ëͳö"> <p>
</FieldSet>
</Form>
</Body>
</HTML>
<%
Set DBconnection = Server.CreateObject("ADODB.Connection")
ConnectionString = "Driver={SQL Server};Server=ETERNAL;Database=gongsi;Uid=sa;Pwd=263501"
DBConnection.open ConnectionString
if Request("xm") <> Empty then
condition="select * from table where xm='" & Request("xm") & "'"
Set RS=Server.CreateObject("ADODB.Recordset")
RS.open condition,BDConnection,1,2
if RS.EOF then
Response.Write"ºÜ±§Ç¸£¬²éÎÞ´ËÓû§" & Request("xm") & "µÄÊý¾Ý"
else
Response.Write"²éµ½µÄÓû§Êý¾ÝÈçÏ£º<br><font Size=10 Color=blue>"
do while not rs.eof
Response.Write (RS("xm") & "<Br>")
loop
next
end if
set rs=nothing
rs.close
end if
%>
ygjwjj 2004-11-14
  • 打赏
  • 举报
回复
Sqlstr="select * from yh"
RS.open Sqlstr,BDConnection,1,1
comstep 2004-11-14
  • 打赏
  • 举报
回复
sql语句错误吧,不太清楚

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧