How ADO accesses databases in conjunction with HTML

Source: Internet
Author: User
Tags access database
How does the 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 ")
Conn1. Open "dbq=" & Server.MapPath ("Ntopsamp.mdb") & ";D river={microsoft Access Driver (*.mdb)};D riverid=25;fil=ms Access; "
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:
<input type=text size=20 value=<%= rs2 ("title")%> >
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:

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.