主题:紧急求救,数据库有数据,但查询不出(一)
同样的两个页面,分别对应着两张表,并且两张表结构完全相同,但一张表可以查出数据,另一张表却不能查出数据,并且不能添加数据.望能者指点迷津!
现附源码如下:
admin_MEMO.asp页:
<!--#include file="conn.asp" -->
<%
'=========删除报价========
if request.form("submitdel")="删除" then
if request.form("DelID")<>"" then
conn.execute "delete from DISK where id in ("&request.form("DelID")&")"
response.write "<script LANGUAGE=""javascript"">"&chr(13)
response.write "alert(""删除成功!"");"&chr(13)
response.write "location.replace('Admin_DISK.asp');</script>"
end if
end if
'==============添加报价======================
if request.form("submitadd")="添加" then
diskName=request.form("diskName")
diskPrice=request.form("diskPrice")
diskLink=request.form("diskLink")
if diskName="" or diskPrice="" then
response.write "<script language='javascript'> alert('型号和报价不能为空!');history.go(-1);</script>"
else
set rs_add=server.createobject("adodb.recordset")
rs_add.open "select * from DISK",conn,1,3
rs_add.addnew
rs_add("diskName")=diskName
rs_add("diskPrice")=diskPrice
rs_add("diskLink")=diskLink
rs_add("add_date")=now()
rs_add.update
rs_add.close
set rs_add=nothing
end if
response.write "<script language='javascript'> alert('添加成功!');location.replace('Admin_DISK.asp');</script>"
end if
'==============修改报价======================
if request.form("submitmf")="修改" then
id=request.querystring("id")
diskName=request.form("diskName")
diskPrice=request.form("diskPrice")
diskLink=request.form("diskLink")
if diskName="" or diskPrice="" or diskLink="" then
response.write "<script language='javascript'> alert('型号、报价及明细链接不能为空!');history.go(-1);</script>"
else
set rs_add=server.createobject("adodb.recordset")
rs_add.open "select * from DISK where id in ("&id&")",conn,1,3
rs_add("diskName")=diskName
rs_add("diskPrice")=diskPrice
rs_add("diskLink")=diskLink
rs_add("add_date")=now()
rs_add.update
rs_add.close
set rs_add=nothing
end if
response.write "<script language='javascript'> alert('修改成功!');location.replace('Admin_DISK.asp');</script>"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>精诚管理中心</title>
<style type="text/css">
<!--
@import url("image/acss.css");
body,td,th {
font-size: 9pt;
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style>
<script language="JavaScript">
function ConfirmDel()
{
if (confirm("确定要删除所选报价吗?"))
return true;
else
return false;
}
</script>
</head>
<body>
<div align=center>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="center" class="downlin">DISK报价修改</td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="16"> </td>
</tr>
<tr>
<td height="30" align="center"><table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td height="25" bgcolor="#CCCCCC" class="suojin">管理员您好,欢迎您登录管理 现在是:<%=year(now)%>年<%=month(now)%>月<%=day(now)%>日 <%=weekdayname(weekday(now))%></td>
</tr>
</table></td>
</tr>
<tr>
<td height="16" align="center">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="78%" height="25"> </td>
<td width="22%" align="right"><a href="Admin_DISK.asp?action=add">添加报价</a>>>></td>
</tr>
</table>
<%if request.querystring("action")="add" then%>
<table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form action="Admin_DISK.asp" method="post" name="form2" onSubmit="return checkform();">
<tr bgcolor="#FFFFFF">
<td width="6%" height="30" align="right" bgcolor="#EFEFEF">型号:</td>
<td width="16%" align="center"><input name="diskName" type="text" class="inputbox" id="diskName" size="15" maxlength="30"></td>
<td width="6%" align="right" bgcolor="#EFEFEF">报价:</td>
<td width="15%" align="center"><input name="diskPrice" type="text" class="inputbox" id="diskPrice" size="15" maxlength="10"></td>
<td width="9%" align="right" bgcolor="#EFEFEF">明细链接:</td>
<td width="31%" align="center"><input name="diskLink" type="text" class="inputbox" id="diskLink" size="35" maxlength="200"></td>
<td width="17%" bgcolor="#EFEFEF"><input name="Submitadd" type="submit" id="Submitadd" value="添加">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</form>
</table>
<%end if%>
<%if request.querystring("action")="mf" then
id=request.querystring("id")
if id<>"" then
set rs_disk=conn.execute("select * from DISK where id in ("&id&")")
do while not rs_disk.eof
%>
<table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form action="Admin_DISK.asp?id=<%=id%>" method="post" name="form3" onSubmit="return checkform1();">
<tr bgcolor="#FFFFFF">
<td width="6%" height="30" align="right" bgcolor="#EFEFEF">型号:</td>
<td width="16%" align="center"><input name="diskName" type="text" class="inputbox" id="diskName" value="<%=rs_disk("diskName")%>" size="15" maxlength="30"></td>
<td width="6%" align="right" bgcolor="#EFEFEF">报价:</td>
<td width="15%" align="center"><input name="diskPrice" type="text" class="inputbox" id="diskPrice" value="<%=rs_disk("diskPrice")%>" size="15" maxlength="10"></td>
<td width="9%" align="right" bgcolor="#EFEFEF">明细链接:</td>
<td width="31%" align="center"><input name="diskLink" type="text" class="inputbox" id="diskLink" value="<%=rs_disk("diskLink")%>" size="35"></td>
<td width="17%" bgcolor="#EFEFEF"><input name="Submitmf" type="submit" id="Submitmf" value="修改">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</form>
</table>
<%
rs_disk.movenext
loop
rs_disk.close
set rs_disk=nothing
end if
end if%>
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from DISK order by id DESC"
rs.Open sql,conn,1 ,1
if rs.eof and rs.bof then
response.write "<p align=center>您还没有添加任何报价!请点这里 <font color=red><a href='Admin_DISK.asp?action=add'>添加报价</a></font> >></p>"
else
dim pageno,totalpages
if request.querystring("pageno")="" then '如果接收到的页数为0
pageno = 1 '则显示第一页
else
pageno=cint(request.querystring("pageno")) '否则就打印接收到的页数
end if
rs.pagesize = 14 '设置每页显示的记录条数
rs.absolutepage = pageno '设置人为的跳转页数为 pageno
totalpages=rs.pagecount '把页面数放在变量‘totalpages'里
%>
<table class="tbt" width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<form action="Admin_DISK.asp" method="post" name="form1">
<tr align="center" bgcolor="#CCCCCC">
<td width="6%" height="25"><strong>选择</strong></td>
<td width="25%"><strong>DISK型号</strong></td>
<td width="9%"><strong>报价</strong></td>
<td width="30%" nowrap="nowrap"><strong>明细链接</strong></td>
<td width="20%"><strong>加入时间</strong></td>
<td width="10%"><strong>查看修改</strong></td>
</tr>
下接:紧急求救,数据库有数据,但查询不出(二)
现附源码如下:
admin_MEMO.asp页:
<!--#include file="conn.asp" -->
<%
'=========删除报价========
if request.form("submitdel")="删除" then
if request.form("DelID")<>"" then
conn.execute "delete from DISK where id in ("&request.form("DelID")&")"
response.write "<script LANGUAGE=""javascript"">"&chr(13)
response.write "alert(""删除成功!"");"&chr(13)
response.write "location.replace('Admin_DISK.asp');</script>"
end if
end if
'==============添加报价======================
if request.form("submitadd")="添加" then
diskName=request.form("diskName")
diskPrice=request.form("diskPrice")
diskLink=request.form("diskLink")
if diskName="" or diskPrice="" then
response.write "<script language='javascript'> alert('型号和报价不能为空!');history.go(-1);</script>"
else
set rs_add=server.createobject("adodb.recordset")
rs_add.open "select * from DISK",conn,1,3
rs_add.addnew
rs_add("diskName")=diskName
rs_add("diskPrice")=diskPrice
rs_add("diskLink")=diskLink
rs_add("add_date")=now()
rs_add.update
rs_add.close
set rs_add=nothing
end if
response.write "<script language='javascript'> alert('添加成功!');location.replace('Admin_DISK.asp');</script>"
end if
'==============修改报价======================
if request.form("submitmf")="修改" then
id=request.querystring("id")
diskName=request.form("diskName")
diskPrice=request.form("diskPrice")
diskLink=request.form("diskLink")
if diskName="" or diskPrice="" or diskLink="" then
response.write "<script language='javascript'> alert('型号、报价及明细链接不能为空!');history.go(-1);</script>"
else
set rs_add=server.createobject("adodb.recordset")
rs_add.open "select * from DISK where id in ("&id&")",conn,1,3
rs_add("diskName")=diskName
rs_add("diskPrice")=diskPrice
rs_add("diskLink")=diskLink
rs_add("add_date")=now()
rs_add.update
rs_add.close
set rs_add=nothing
end if
response.write "<script language='javascript'> alert('修改成功!');location.replace('Admin_DISK.asp');</script>"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>精诚管理中心</title>
<style type="text/css">
<!--
@import url("image/acss.css");
body,td,th {
font-size: 9pt;
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style>
<script language="JavaScript">
function ConfirmDel()
{
if (confirm("确定要删除所选报价吗?"))
return true;
else
return false;
}
</script>
</head>
<body>
<div align=center>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" align="center" class="downlin">DISK报价修改</td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="16"> </td>
</tr>
<tr>
<td height="30" align="center"><table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<td height="25" bgcolor="#CCCCCC" class="suojin">管理员您好,欢迎您登录管理 现在是:<%=year(now)%>年<%=month(now)%>月<%=day(now)%>日 <%=weekdayname(weekday(now))%></td>
</tr>
</table></td>
</tr>
<tr>
<td height="16" align="center">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="78%" height="25"> </td>
<td width="22%" align="right"><a href="Admin_DISK.asp?action=add">添加报价</a>>>></td>
</tr>
</table>
<%if request.querystring("action")="add" then%>
<table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form action="Admin_DISK.asp" method="post" name="form2" onSubmit="return checkform();">
<tr bgcolor="#FFFFFF">
<td width="6%" height="30" align="right" bgcolor="#EFEFEF">型号:</td>
<td width="16%" align="center"><input name="diskName" type="text" class="inputbox" id="diskName" size="15" maxlength="30"></td>
<td width="6%" align="right" bgcolor="#EFEFEF">报价:</td>
<td width="15%" align="center"><input name="diskPrice" type="text" class="inputbox" id="diskPrice" size="15" maxlength="10"></td>
<td width="9%" align="right" bgcolor="#EFEFEF">明细链接:</td>
<td width="31%" align="center"><input name="diskLink" type="text" class="inputbox" id="diskLink" size="35" maxlength="200"></td>
<td width="17%" bgcolor="#EFEFEF"><input name="Submitadd" type="submit" id="Submitadd" value="添加">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</form>
</table>
<%end if%>
<%if request.querystring("action")="mf" then
id=request.querystring("id")
if id<>"" then
set rs_disk=conn.execute("select * from DISK where id in ("&id&")")
do while not rs_disk.eof
%>
<table width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form action="Admin_DISK.asp?id=<%=id%>" method="post" name="form3" onSubmit="return checkform1();">
<tr bgcolor="#FFFFFF">
<td width="6%" height="30" align="right" bgcolor="#EFEFEF">型号:</td>
<td width="16%" align="center"><input name="diskName" type="text" class="inputbox" id="diskName" value="<%=rs_disk("diskName")%>" size="15" maxlength="30"></td>
<td width="6%" align="right" bgcolor="#EFEFEF">报价:</td>
<td width="15%" align="center"><input name="diskPrice" type="text" class="inputbox" id="diskPrice" value="<%=rs_disk("diskPrice")%>" size="15" maxlength="10"></td>
<td width="9%" align="right" bgcolor="#EFEFEF">明细链接:</td>
<td width="31%" align="center"><input name="diskLink" type="text" class="inputbox" id="diskLink" value="<%=rs_disk("diskLink")%>" size="35"></td>
<td width="17%" bgcolor="#EFEFEF"><input name="Submitmf" type="submit" id="Submitmf" value="修改">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</form>
</table>
<%
rs_disk.movenext
loop
rs_disk.close
set rs_disk=nothing
end if
end if%>
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from DISK order by id DESC"
rs.Open sql,conn,1 ,1
if rs.eof and rs.bof then
response.write "<p align=center>您还没有添加任何报价!请点这里 <font color=red><a href='Admin_DISK.asp?action=add'>添加报价</a></font> >></p>"
else
dim pageno,totalpages
if request.querystring("pageno")="" then '如果接收到的页数为0
pageno = 1 '则显示第一页
else
pageno=cint(request.querystring("pageno")) '否则就打印接收到的页数
end if
rs.pagesize = 14 '设置每页显示的记录条数
rs.absolutepage = pageno '设置人为的跳转页数为 pageno
totalpages=rs.pagecount '把页面数放在变量‘totalpages'里
%>
<table class="tbt" width="760" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<form action="Admin_DISK.asp" method="post" name="form1">
<tr align="center" bgcolor="#CCCCCC">
<td width="6%" height="25"><strong>选择</strong></td>
<td width="25%"><strong>DISK型号</strong></td>
<td width="9%"><strong>报价</strong></td>
<td width="30%" nowrap="nowrap"><strong>明细链接</strong></td>
<td width="20%"><strong>加入时间</strong></td>
<td width="10%"><strong>查看修改</strong></td>
</tr>
下接:紧急求救,数据库有数据,但查询不出(二)