ASP used in the collection of bulk Database
First, a collection of HTML attribute
First of all, let us get to know HTML attribute set. In the form (FORM) data or enquiries (Query) parameters, when presented with a number of parameters using a name, these parameter values would constitute a set of ASP pages can be obtained in these parameter values or the number of parameters of the same name . If in the following pages (Set.HTM), the box uses the same six parameters of a MyCheckBox, respectively 1,2,3,4,5,6.
<! - Set.HTM ->
<html> <head> <title> Set attributes of </ title> </ head> <body>
<p> Choose to operate the project after submission of data, will show you choose projects.
<form Method="POST" action="set.asp">
<br> 1, <input type="checkbox" name="MyCheckBox" value="1">
<br> 2, <input type="checkbox" name="MyCheckBox" value="2">
<br> 3, <input type="checkbox" name="MyCheckBox" value="3">
<br> 4, <input type="checkbox" name="MyCheckBox" value="4">
<br> 5, <input type="checkbox" name="MyCheckBox" value="5">
<br> 6, <input type="checkbox" name="MyCheckBox" value="6">
<br> <input Type="submit" value="æäº¤æ•°æ®" name="B1">
</ Form> </ body> </ html>
When the client chose to demonstrate that the project, the following ASP pages (Set.ASP) is the client choose the number and value of projects.
<! - Set.ASP ->
<% @ LANGUAGE = VBScript%>
<html> <head> <title> Pools testing </ title> </ head>
<body>
<%
Response.Write "<br> you have chosen the" & request ( "MyCheckBox"). Count & "item"
Response.Write "<br> your choice of projects:" & request ( "MyCheckBox")
%>
</ Body> </ html>
Such as when clients choose the second, three, five and submit data, will see the following results:
You have a choice of three,
You choose the projects are: 2, 3, 5
It should be noted, "2, 3, 5," in the form of SQL statements and is consistent with the requirements of the form, we can use directly or indirectly the result of this form, such as "Select * from ATable where AFiled in (" & request ( "MyCheckBox") & ")" the actual SQL query for "Select * from ATable where AFiled in (2, 3, 5)."
Second, a collection of attributes HTML Application Below we combine a practical example of how to discuss the use of ASP pages in a collection of HTML attribute database to bulk operations. Now we have a record of customer e-mail database EMail ACCESS, which has a data table EmailList, including CustomerId, CustomerName, CustomerEmail three fields, namely customer number, customer name, customer e-mail. SelectId.ASP in ASP pages, we list all customers using CheckBox the customer's name (all CheckBox values for the corresponding customer number), which allows users to select customers to send e-mail. When users select the customer and submitted to the data, SendMail.ASP to these customers will retrieve e-mail and e-mail sent to these customers. Specific information, please see below ASP code and annotation information.
<! - SelectId.ASP: list all the customer's name, ->
<html> <head> <title> All customers of a customer's name </ title> </ head> <body>
<p Align=center> <font style="font-family:宋体; font-size:9pt">
Please choose what to give your customers "New Year greetings," the e-mail
<form Method="POST" action="SendMail.asp">
<% 'To establish connections with the ACCESS database
Set dbConnection = Server.CreateObject ( "ADODB.Connection")
DbConnection.open "Driver = (Microsoft Access Driver (*. mdb )};"&_
"DBQ = C: \ inetpub \ wwwroot \ test \ Email.mdb"
'Access to all customer's customer number, customer name
Set rsCustomers = Server.CreateObject ( "ADODB.RecordSet")
RsCustomers.Open "Select CustomerId, CustomerName, CustomerEmail From EmailList" _
DbConnection, 1,3,1
'Show all customers of a customer's name
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 = "e-mail sent to customers," name = "B1"
Style = "font-family: 10 lines; font-size: 9pt">
</ Form> </ body> </ html>
<! - SendMail.ASP: chosen by the customer to e-mail ->
<html> <head> <title> Chosen by the customer to e-mail </ title> </ head> <body>
<p Align=center> <font style="font-family:宋体; font-size:9pt">
Below is the e-mail client
<% 'To establish connections with the ACCESS database
Set dbConnection = Server.CreateObject ( "ADODB.Connection")
DbConnection.open "Driver = (Microsoft Access Driver (*. mdb )};"&_
"DBQ = C: \ inetpub \ wwwroot \ test \ Email.mdb"
'Chosen by the customer access to the e-mail
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
'To a customer e-mail
Set myMail = CreateObject ( "CDONTS.NewMail")
MyMail.From = "sales@test.com"
MyMail.value ( "Reply-To") = "sales@test.com"
MyMail.To = rsCustomers ( "CustomerEmail")
MyMail.Subject = "from the Army-New Year greetings"
MyMail.BodyFormat = 1
MyMail.MailFormat = 1
MyMail.Body = "Wang Jun, the" & rsCustomers ( "CustomerName") & "hello!"
MyMail.Send
Set myMail = Nothing
%>
<br> To <a href = "mailto: <% = rsCustomers (" CustomerEmail ")%>"><%= rsCustomers ( "CustomerName ")%></ a>
E-mail success!
<%
RsCustomers.MoveNext
Wend
RsCustomers.close
Set rsCustomers = nothing
DbConnection.close
Set dbConnection = nothing
%>
<br> Chosen by the customer in the e-mail ready!
</ Body> </ html>
WINNT4.0 above procedures IIS4.0 + ASP2.0 + + debugging through Access97.
(Author: Wang Jun, wangfajun@163.net http://wangfajun.163.net)
List all of your Session Variables
<% @ Language VBScript% =>
<Option Explicit%%>
<%
Response.Write "in the process you have to use the" & & _ Session.Contents.Count
"Since Session variables <P>"
Dim strName, iLoop
For Each strName in Session.Contents
'Judging whether a variable is an array Session
If IsArray (Session (strName)) then
'If it is an array, then Romania list all elements of an array content
For iLoop = LBound (Session (strName)) to UBound (Session (strName))
Response.Write strName & "(" & & iLoop ") -" & _
Session (strName) (iLoop) & "<BR>"
Next
Else
'If it is not an array, then direct show
Response.Write strName & "-" & Session.Contents (strName) & "<BR>"
End If
Next
%>








0 Comments to “ASP used in the collection of bulk Database”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.