asp在指定文本中显示数据库数据
如题代码如下value报了错该怎么改才可以啊跪求!!!<!--#includefile="conn.asp"--><%dimidid=trim(request("cp_i...
如题代码如下 value报了错该怎么改才可以啊 跪求!!!
<!--#include file="conn.asp"-->
<%
dim id
id=trim(request("cp_id"))
set rs=server.createobject("adodb.recordset")
sql= " select * from CPXX where cp_id='&id&'"
rs.open sql, conn,3,3
if id= "" then
response.write "<script language='javascript'>window.confirm('ID不能为空!请重新填写!!');</script>"
response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
if not(rs.bof and rs.eof) then
response.write "<script language='javascript'>window.confirm('ID不不存在!请重新填写!!');</script>"
response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
%>
<html>
<body>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<form method="post" action= "up.asp" >
<table border="0" width="100%" cellspacing="0" cellpading="3">
<tr>
<td width="100%" align="center" colspan="2" >
<p align="center">产品信息</td>
</tr>
<tr>
<td width="45%" align="right" >产品编号:</td>
<td width="55%"><input type="text" name="cp_id" size="20" value="<%rs("cp_id")%>"></td>
</tr>
<tr>
<td width="45%" align="right" >产品名称:</td>
<td width="55%"><input type="text" name="cp_mc" size="20" value="<%rs("cp_mc")%>"></td>
</tr>
<td width="45%" align="right" >贴花价格:</td>
<td width="55%"><input type="text" name="th_jg" size="20" value="<%rs("th_jg")%>"></td>
</tr>
<tr>
<td width="100%" align="right" colspan="2" >
<p align ="right" ><input type="submit" value=" 确认 " name="B1"> <input type="reset" value=" 全部重写 " name="B2" ></td>
</form>
</table>
</body>
</heml>
Microsoft VBScript 运行时错误 (0x800A01C2)
错误的参数个数或无效的参数属性值: 'rs'
/xgcx.asp, 第 34 行
这个错误
我希望在那个文本框中 直接显示数据库中的cp_id cp_mc 和th_jg 展开
<!--#include file="conn.asp"-->
<%
dim id
id=trim(request("cp_id"))
set rs=server.createobject("adodb.recordset")
sql= " select * from CPXX where cp_id='&id&'"
rs.open sql, conn,3,3
if id= "" then
response.write "<script language='javascript'>window.confirm('ID不能为空!请重新填写!!');</script>"
response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
if not(rs.bof and rs.eof) then
response.write "<script language='javascript'>window.confirm('ID不不存在!请重新填写!!');</script>"
response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
end if
%>
<html>
<body>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<form method="post" action= "up.asp" >
<table border="0" width="100%" cellspacing="0" cellpading="3">
<tr>
<td width="100%" align="center" colspan="2" >
<p align="center">产品信息</td>
</tr>
<tr>
<td width="45%" align="right" >产品编号:</td>
<td width="55%"><input type="text" name="cp_id" size="20" value="<%rs("cp_id")%>"></td>
</tr>
<tr>
<td width="45%" align="right" >产品名称:</td>
<td width="55%"><input type="text" name="cp_mc" size="20" value="<%rs("cp_mc")%>"></td>
</tr>
<td width="45%" align="right" >贴花价格:</td>
<td width="55%"><input type="text" name="th_jg" size="20" value="<%rs("th_jg")%>"></td>
</tr>
<tr>
<td width="100%" align="right" colspan="2" >
<p align ="right" ><input type="submit" value=" 确认 " name="B1"> <input type="reset" value=" 全部重写 " name="B2" ></td>
</form>
</table>
</body>
</heml>
Microsoft VBScript 运行时错误 (0x800A01C2)
错误的参数个数或无效的参数属性值: 'rs'
/xgcx.asp, 第 34 行
这个错误
我希望在那个文本框中 直接显示数据库中的cp_id cp_mc 和th_jg 展开
3个回答
展开全部
你在连接的时候传值啦 你可以写成这样
<%
set rs=server.createobject("adodb.recordset")
sql= " select * from CPXX where cp_id='&trim(request("cp_id"))&'"
rs.open sql, conn,3,3
%>
<html>
<body>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<form method="post" action= "up.asp" >
<table border="0" width="100%" cellspacing="0" cellpading="3">
<tr>
<td width="100%" align="center" colspan="2" >
<p align="center">产品信息</td>
</tr>
<tr>
<td width="45%" align="right" >产品编号:</td>
<td width="55%"><input type="text" name="cp_id" size="20" value="<%rs("cp_id")%>"></td>
</tr>
<tr>
<td width="45%" align="right" >产品名称:</td>
<td width="55%"><input type="text" name="cp_mc" size="20" value="<%rs("cp_mc")%>"></td>
</tr>
<td width="45%" align="right" >贴花价格:</td>
<td width="55%"><input type="text" name="th_jg" size="20" value="<%rs("th_jg")%>"></td>
</tr>
<tr>
<td width="100%" align="right" colspan="2" >
<p align ="right" ><input type="submit" value=" 确认 " name="B1"> <input type="reset" value=" 全部重写 " name="B2" ></td>
</form>
</table>
</body>
</heml>
<%
set rs=server.createobject("adodb.recordset")
sql= " select * from CPXX where cp_id='&trim(request("cp_id"))&'"
rs.open sql, conn,3,3
%>
<html>
<body>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<form method="post" action= "up.asp" >
<table border="0" width="100%" cellspacing="0" cellpading="3">
<tr>
<td width="100%" align="center" colspan="2" >
<p align="center">产品信息</td>
</tr>
<tr>
<td width="45%" align="right" >产品编号:</td>
<td width="55%"><input type="text" name="cp_id" size="20" value="<%rs("cp_id")%>"></td>
</tr>
<tr>
<td width="45%" align="right" >产品名称:</td>
<td width="55%"><input type="text" name="cp_mc" size="20" value="<%rs("cp_mc")%>"></td>
</tr>
<td width="45%" align="right" >贴花价格:</td>
<td width="55%"><input type="text" name="th_jg" size="20" value="<%rs("th_jg")%>"></td>
</tr>
<tr>
<td width="100%" align="right" colspan="2" >
<p align ="right" ><input type="submit" value=" 确认 " name="B1"> <input type="reset" value=" 全部重写 " name="B2" ></td>
</form>
</table>
</body>
</heml>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
sql= " select * from CPXX where cp_id="&id
response.write sql
看看对不对
response.write sql
看看对不对
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
先更改以下内容:
1. sql= " select cp_id,cp_mc,th_jg from CPXX where cp_id='" & id & "'"
2.</heml> -》</html>
1. sql= " select cp_id,cp_mc,th_jg from CPXX where cp_id='" & id & "'"
2.</heml> -》</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询