如何在页面中对不同的数据进行相同的处理?

时间:2010-06-26 12:30:00 

如何在页面中对不同的数据进行相同的处理?

selectId.asp

' 列出所有客户的客户名称
<html>
<head>
<title>客户名单 - asp之家 www.aspxhome.com</title>
</head><
body>
<p align=center><font style="font-family:宋体;font-size:9pt">
请选择要给发送的电子邮件的客户:
<form method="POST" action="SendMail.asp">
<%
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.open "Driver={Microsoft Access Driver (*.mdb)};"&_
"DBQ=C:\inetpub\wwwroot\test\Email.mdb"
' 建立与Access数据库的连接
Set rsCustomers = Server.CreateObject("ADODB.RecordSet")
rsCustomers.Open "Select CustomerId,CustomerName,CustomerEmail From 
EmailList",_
' 获取所有客户的客户编号、客户名称
                dbConnection,1,3,1
while not rsCustomers.eof
' 显示所有客户的客户名称
%>
<br><input type="checkbox" name="CustomerId" value="<%=rsCustomers("CustomerId")%>">
<a href="mailto:<%=rsCustomers("CustomerEmail")%>">
<%=rsCustomers("CustomerName")%></a>
<%rsCustomers.MoveNext
wend
rsCustomers.close
set rsCustomers = nothing
dbConnection.close
set dbConnection = nothing
%>
<br><input type="submit" value="发信" name="B1" style="font-family:宋体;font-size:9pt">
</form>
</body>
</html>

sendmail.asp

' 给所选择客户发电子邮件
<html>
<head>
<title>精彩春风之发送邮件</title>
</head>
<body>
<p align=center>
邮件正在发送中!请稍候...
<%
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.open "Driver={Microsoft Access Driver (*.mdb)};"&_
"DBQ=C:\inetpub\wwwroot\test\Email.mdb"
' 建立与Access数据库的连接
Set rsCustomers = Server.CreateObject("ADODB.RecordSet")
rsCustomers.Open "Select CustomerName,CustomerEmail From EmailList 
' 获取所选择客户的电子信箱
where CustomerId in ("&_
                  Request("CustomerId")&")",dbConnection,1,3,1
while not rsCustomers.eof
Set myMail = CreateObject("CDONTS.NewMail") 
myMail.From = "chunfeng@intels.net"
myMail.value("Reply-To") = "chunfeng@intels.net"
myMail.To = rsCustomers("CustomerEmail")
myMail.Subject = "来自随风起舞的问候!" 
myMail.BodyFormat = 1
myMail.MailFormat = 1  
myMail.Body = "精彩春风恭祝"&rsCustomers("CustomerName")&"幸福平安,工作顺利!"
myMail.Send 
' 给客户发邮件
Set myMail = Nothing 
%>
<br>
<ahref="恭喜,已成功给:<%=rsCustomers("CustomerEmail")%>"> <%=rsCustomers("CustomerName")%></a>发送电子邮件!
<%
rsCustomers.MoveNext
wend
rsCustomers.close
set rsCustomers = nothing
dbConnection.close
set dbConnection = nothing
%>
<br>恭喜,已成功给所有选择的客户发送邮件完毕!
</body>
</html>

标签:数据,asp
0
投稿

猜你喜欢

  • Python实现PS滤镜的万花筒效果示例

    2023-11-15 10:17:25
  • 关于爬虫和反爬虫的简略方案分享

    2022-08-01 09:54:53
  • Pytorch GPU显存充足却显示out of memory的解决方式

    2022-05-20 18:56:58
  • python计算圆周长、面积、球体体积并画出圆

    2022-08-15 06:19:59
  • js加密页面代码生成器

    2007-10-12 13:40:00
  • python深度学习TensorFlow神经网络模型的保存和读取

    2022-03-18 06:49:01
  • .NET之生成数据库全流程实现

    2024-01-16 05:08:48
  • MySQL两种表存储结构MyISAM和InnoDB的性能比较测试

    2024-01-28 02:35:55
  • OpenCV2从摄像头获取帧并写入视频文件的方法

    2022-04-10 07:15:22
  • 在Pycharm的Project Files下建立多个项目的操作

    2022-02-20 16:27:49
  • Python二叉树的遍历操作示例【前序遍历,中序遍历,后序遍历,层序遍历】

    2022-07-06 16:40:59
  • MySQL 1303错误的解决方法(navicat)

    2024-01-25 21:24:42
  • 在ASP.NET 2.0中操作数据之五十:为GridView控件添加Checkbox

    2023-06-26 19:18:09
  • 在自动化中用python实现键盘操作的方法详解

    2021-02-04 00:23:48
  • Python socket网络编程TCP/IP服务器与客户端通信

    2023-09-13 01:46:02
  • javascript json字符串到json对象转义问题

    2023-07-02 05:18:22
  • Django+Celery实现动态配置定时任务的方法示例

    2021-06-11 13:56:19
  • Python Opencv图像处理基本操作代码详解

    2023-06-08 08:08:05
  • YUI学习笔记(3)

    2009-01-21 16:24:00
  • Python入门必须知道的11个知识点

    2023-12-19 05:32:47
  • asp之家 网络编程 m.aspxhome.com