设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 65|回复: 2
打印 上一主题 下一主题

怎样将此"修改页面"和"修改后处理页面"合二为一

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-17 04:01:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
'修改页面
<%
strID = Request("tID")
set conn = Server.CreateObject("ADODB.Connection")
conn.Open("driver={SQL Server};database=pubs;server=(LOCAL);uid=sa;pwd=111111")
strSQL = "select * from txl Where tID ="&strID
set rs = conn.Execute(strSQL)
%>
<form name="form1" method="post" action="modifySumit.asp">
<% '输出表的内容
If not rs.EOF Then
%>
<table align="center" width="361" border="0"style="color:#3E96A6 ">
<tr>
<td align="center" bgcolor="#3E96A6"><span class="style11"><%=rs("tName")%>的通讯录</span></td>
</tr>
</table>
<table width="361" border="0" align="center" cellpadding="1">
<tr>
<td width="132">&nbsp;</td>
<td width="219"><input type="hidden" name="tID" value="<%=rs("tID")%>"></td>
</tr>
<tr>
<td><span class="style7">EMAIL:</span></td>
<td><input name="tEmail" type="text" size="30" value="<%=rs("tEmail")%>"></td>
</tr>
<tr>
<td><span class="style7">手机号码:</span></td>
<td><input name="tMobile" type="text" size="30"value="<%=rs("tMobile")%>"></td>
</tr>
<tr>
<td><span class="style7">固定电话:</span></td>
<td><input name="tHomePhone" type="text" size="30"value="<%=rs("tHomePhone")%>"></td>
</tr>
<tr>
<td align="left" valign="top"><p class="style7">QQ:</p></td>
<td><input name="tQQ" type="text" size="30"value="<%=rs("tQQ")%>"></td>
</tr>
<tr>
<td align="left" valign="top"><span class="style7">备注:</span></td>
<td><span class="style7">
<textarea name="tMemo" cols="29" rows="3"><%=rs("tMemo")%></textarea>
</span></td>
</tr>
<tr>
<td align="left" valign="top">&nbsp;</td>
<td><span class="style7">
<input type="submit" name="Submit" value="修改完毕">
</span></td>
</tr>
</table>
<%
End If
%>
</form>


修改后处理页面:
<%
tID = TRIM( REQUEST("tID"))
tEmail = TRIM( REQUEST("tEmail"))
tMobile = TRIM( REQUEST("tMobile"))
tHomePhone = TRIM( REQUEST("tHomePhone"))
tQQ = TRIM( REQUEST("tQQ"))
tMemo = TRIM( REQUEST("tMemo"))

set conn = Server.CreateObject("ADODB.Connection")
conn.Open("driver={SQL Server};database=pubs;server=127.0.0.1;uid=sa;pwd=111111")
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
SQL = "UPDATE txl SET tEmail='"&tEmail&"',tMobile='"&tMobile&"',tHomePhone='"&tHomePhone&"',tQQ='"&tQQ&"',tMemo='"&tMemo&"' Where tID="&tID
Response.Write(SQL)
cmd.CommandText = SQL
cmd.Execute()
Response.Redirect("index.asp")
%>


据说用IF ...ELSE.....THEN ....语句可以将此两个程序写在一起,敬请指点!!!
2#
发表于 2010-1-17 04:01:19 | 只看该作者
修改后处理页面:
<%
tID = TRIM( REQUEST("tID"))
tEmail = TRIM( REQUEST("tEmail"))
tMobile = TRIM( REQUEST("tMobile"))
tHomePhone = TRIM( REQUEST("tHomePhone"))
tQQ = TRIM( REQUEST("tQQ"))
tMemo = TRIM( REQUEST("tMemo"))

set conn = Server.CreateObject("ADODB.Connection")
conn.Open("driver={SQL Server};database=pubs;server=127.0.0.1;uid=sa;pwd=111111")
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
SQL = "UPDATE txl SET tEmail='"&tEmail&"',tMobile='"&tMobile&"',tHomePhone='"&tHomePhone&"',tQQ='"&tQQ&"',tMemo='"&tMemo&"' Where tID="&tID
Response.Write(SQL)
cmd.CommandText = SQL
cmd.Execute()
Response.Redirect("index.asp")
%>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-18 18:23 , Processed in 0.242664 second(s), 8 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表