Institute of the fourth day of the 10-day ASP
Learning Objective: To grasp ACCESS database connectivity and access records
Today, we should learn from the contents of that boring, but very important. Here we do not have to know to order specific performance, the outside is not suitable for a lot of books because entry is introduced too much theoretical knowledge for beginners feel.
Below came straight to see two sentences:
<%
Set conn = server.createobject ( "adodb.connection")
Conn.open "driver = (microsoft access driver (*. mdb)); dbq =" & server.mappath ( "example3.mdb")
%>
The first sentence defines a adodb database connectivity components, the second sentence connected to the database, as long as you modify the database name on the back of it. It is so simple?
Below look at three:
<%
Exec = "select * from guestbook"
Set rs = server.createobject ( "adodb.recordset")
Rs.open exec, conn, 1,1
%>
This increase in the three behind the front two, the first sentence: Setting the order to query the database, select the field behind the increase, if it will be for the use *, from behind the table with the names, we set up in front of the is not a gustbook Table A? The second sentence: definition of a record set components, to search all the records on the inside, third sentence, is set to open this record, in front of exec is the definition of order enquiries, conn front is the definition of database connectivity components, behind parameters "1,1", which is read, modify records put behind mentioned parameters set to 1,3, then we read a good record.
<table Width="100%" border="0" cellspacing="0" cellpadding="0">
<% Do while not rs.eof%> <tr>
<td> <% = Rs ( "name ")%></ td>
<td> <% = Rs ( "tel ")%></ td>
<td> <% = Rs ( "message ")%></ td>
<td> <% = Rs ( "time ")%></ td>
</ Tr> <%
Rs.movenext
Loop
%>
</ Table>
In a form, we have four shows separately the establishment of the table inside the last of the four fields, with do cycle, the meaning is not rs.eof conditions did not read the record set Finally, the meaning is rs.movenext To show an End Below is equivalent to a record ,<%=%> <% response.write%> in the html code for insertion inside asp code, the main variables for the show.
On the good end today, we can practice more, I can download and look at the examples, some debugging. Below are the results of my machines above picture.

Tags: ASP








0 Comments to “Institute of the fourth day of the 10-day ASP”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.