ado| Data | How does the database ASP cooperate with the HTML code to show the results of executing ADO query database data?
For a detailed combination of the ASP with Select, CHECKBOX, and radio, please refer to the following: Initialize the Drop-down menu using Dynamic Data, initialize the radio box with Dynamic Data, use Dynamic Data initialization check box, here is a simple introduction.
ASP program code part, first use ADO link to Access database ntopsamp.mdb, under SQL instruction "select * from book" Check
Consult all the data in the "book" of the form and send the results of the query back to the RS2 recordset:
<%
Set conn1 = Server.CreateObject ("ADODB. Connection ")
Set rs2 = Server.CreateObject ("ADODB. Recordset ")
SQLSTR = "SELECT * FROM book"
Rs2. Open sqlstr,conn1,1,1
%>
The result of the query is then combined with the RS2 recordset and the HTML code, which is displayed in the browser.
First, merry-go text marquee
The client uses a browser to browse the results of the execution of the rs51.asp, merry-go text that moves from right to left. With the merry-go text <Marquee>
The HTML code combines ASP code as follows:
<marquee><%= rs2 ("title")%></marquee>
Where "rs2 (" book title ") Displays the information in the title field of the Book table as merry-go text.
Second, text input text
The ASP code that combines the text input HTML code text is as follows:
Where value is "rs2 (" book title "), the text is entered as a preset field" book title "Data.
Three, multiple lines of text input textarea
The ASP code that combines the HTML code < Textarea> entered with multiline text is as follows:
<textarea><%= rs2 ("title")%></textarea>
Where "rs2 (" book title "), enter multiple lines of text into the preset field" book title "Data.
Four, check the checkbox
The ASP code that is combined with the checked HTML code checkbox is as follows:
<input Type=checkbox <% if Rs2 ("new book") = True then%> Checked <% End If%>> new book
It is checked by "if rs2 (" new book ") = True then" Check the value of the field "new book" in the "books" table and, if true, tick (Checked).
Five, pictures
The HTML code for the picture combines ASP code as follows:
">
Where "rs2 (" book title ") shows the data for the field" picture "as a picture," ... /rds/"set the picture file path to rds/," ... /"is represented as the path to the previous layer.
Six, Super Link
The ASP code that combines the hyperlink HTML code <a href...> is as follows:
Where "rs2 (" book title ") is the field" book title "Data, by"do while not Rs. Eof... loop"cycle and"rs. movenext"
Move to the next record, "not Rs. eof"indicates that it has not been moved to the end, displaying all the data from the books table to the radio options.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.