ASP数据字段二次写入-新手求助
各位老大学习过程中遇到一个问题,查询出之前的一个记录.要再次向这第记录中写入其它字段的数据.
我现在每次写入都会增加一条记录.
如下源码
<!--#include file="conn.asp" -->
<!--#include file="config.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%= webname %></title>
<link href="images/main.css" rel="stylesheet" type="text/css"><style type="text/css">
<!--
body {
background-image: url(admin/images/login_04.gif);
}
.STYLE2 {color: #FF0000}
-->
</style></head>
<body>
<p> </p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="24%" valign="top"><!--#include file="ysleft.asp" --></td>
<td width="76%" align="center" valign="top"><br>
<table width="99%" border="0" cellpadding="2" cellspacing="1" bgcolor="#66CC00">
<form name="form1" method="post" action="?action=sersach"><tr>
<td height="25" colspan="11" bgcolor="#CFE4B2"><% if request.form("sersch")<>"" or request("s")<>"" then serchmsg="<br> 你搜索的内容是:<font color=#FF0000>"&request.form("sersch")&request("s")&"</font> <a href=?>点击这里查看所有信息</a>" %>
请输入技术员姓名进行搜索:
<input name="sersch" type="text" id="sersch">
<input type="submit" name="Submit3" value="搜索">
<%= serchmsg %></td>
</tr></form>
<tr>
<td height="25" colspan="11" background="admin/images/bj.gif" bgcolor="#0080C0"> <strong>门店报修管理</strong></td>
</tr>
<tr>
<td width="17%" height="30" align="center" bgcolor="#CFE4B2">编号</td>
<td width="16%" align="center" bgcolor="#CFE4B2">门店名称</td>
<td width="13%" align="center" bgcolor="#CFE4B2">技术员</td>
<td width="24%" align="center" bgcolor="#CFE4B2">报修项目</td>
<td width="15%" align="center" bgcolor="#CFE4B2">故障报修时间</td>
<td width="15%" align="center" bgcolor="#CFE4B2">详细情况/维修报告</td>
</tr>
<% '打开预约记录
Set Rs = Server.CreateObject("ADODB.RecordSet")
if request("action")="sersach" then sersach=" and ysname like '%"&request.form("sersch")&"%'" '按输入的搜索框进行搜索
if request("s")<>"" then sersach=" and ysname like '%"&request("s")&"%'" '按传递值进行搜索
Sql = "Select * From [DB_yy] where ID>0 "&sersach&" Order By ID Desc"
Rs.Open Sql,Conn,1,1
If Rs.Eof And Rs.Bof Then
Response.Write "<tr><td height=40 colspan=9 align=center bgcolor=#FFFFFF>暂无<font color=#FF0000>"&request.form("sersch")&request("s")&"</font>技术员预约信息</td></tr>"
Else
Page = Request("Page")
If Page="" Then Page=1
Rs.PageSize = 6 '每页记录数量
PageSize = Rs.PageSize
Rs.AbsolutePage = Page
Do While Not Rs.Eof And PageSize>0
%>
<tr bgcolor="#FFFFFF">
<td height="25" align="center">PC058<%=Rs("id")%></td>
<td align="center"><%=Rs("jmname")%></td>
<td align="center"><%=Rs("ysname")%></td>
<td align="center"><%=Rs("itemname")%></td>
<td align="center"><%=Rs("yydate")%></td>
<td align="center" bgcolor="#FFFFFF" onClick="document.all.a<%=Rs("id")%>.style.display=(document.all.a<%=Rs("id")%>.style.display =='none')?'':'none';" style="cursor:hand" >查看/填写</td>
</tr>
<tr id="a<%=Rs("id")%>" style="display:none;">
<td height="25" colspan="11" bgcolor="#FFFFFF">
<!-- 机型:<%=Rs("sbxh")%> -->
<!-- 故障详情:<%=Rs("memo")%> -->
<table width="794" border="0">
<tr>
<td width="74">设备型号:</td>
<td width="710"><%=Rs("sbxh")%></td>
</tr>
<tr>
<td>故障详情:</td>
<td><%=Rs("memo")%></td>
<form name="editFrm" method="post" action="?action=edit" onSubmit="return(ChkeditFrm());">
<tr>
<td>到达时间:</td>
<td><input name="ddsj" type="text" id="ddsj">
<span class="STYLE2">格式为:2011-6-17 10:10 </span></td>
</tr>
<tr>
<td>故障原因:</td>
<td><textarea name="gzyy" cols="40" rows="4" id="gzyy"></textarea></td>
</tr>
<tr>
<td>处理方法:</td>
<td><textarea name="clff" cols="40" rows="4" id="clff"></textarea></td>
</tr>
<tr>
<td>耗用材料:</td>
<td><textarea name="haoc" cols="40" rows="4" id="haoc"></textarea></td>
</tr>
<tr>
<td>离开时间:</td>
<td><input name="lksj" type="text"value="<%=now()%>" id="lksj"></td>
</tr>
<tr><td height="35" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="确定填写">
<input type="reset" name="Submit2" value="清除"></td>
</tr>
</form>
</table> </td>
</tr>
<% PageSize = PageSize-1
Rs.MoveNext
Loop
%>
<tr>
<td height="25" colspan="11" align="right" bgcolor="#E6E6E6">
<%
Response.Write "每页" &Rs.PageSize& "条/共" &Rs.RecordCount& "条 第" &Page& "页/共" &Rs.PageCount& "页 "
Response.Write "<a href=?s="&request("s")&request.form("sersch")&"&Page=1>首页</a> "
If CInt(Page)>1 then
Response.Write "<a href=?s="&request("s")&request.form("sersch")&"&Page="&Page-1&">上一页</a> "
Else
Response.Write "上一页 "
End If
If CInt(Page)<Rs.PageCount then
Response.Write "<a href=?s="&request("s")&request.form("sersch")&"&Page="&Page+1&">下一页</a> "
Else
Response.Write "下一页 "
End If
Response.Write "<a href=?s="&request("s")&request.form("sersch")&"&Page="&Rs.PageCount&">末页</a> "
%> </td>
</tr>
<%
End If
Rs.Close
Set Rs=nothing
%>
</table>
</table>
</body>
</html>
<% If Request("action")="edit" Then
Call Save_Edit()
End If
'添加维修单数据
Sub Save_Edit()
ddsj=trim(request.form("ddsj"))
gzyy=trim(request.form("gzyy"))
clff=trim(request.form("clff"))
haoc=trim(request.form("haoc"))
lksj=trim(request.form("lksj"))
'查找相应的技术员名字
sqlys="select * from DB_yy where id="&cint(ysname)
set rsys=server.createobject("adodb.recordset")
rsys.open sqlys,conn,1,3
ysname=rsys("name")'name
rsys.close
set rsys=Nothing
'添加预约信息
sql="select * from DB_yy"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("ddsj")=ddsj
rs("gzyy")=gzyy
rs("clff")=clff
rs("haoc")=haoc
rs("lksj")=lksj
rs.update
rs.close
set rs=Nothing
Response.Write "<Script>alert('填写成功!');location.href='?';</Script>"
End Sub
%>