Modify Fig. 25.12’s guestbook.asp to read and write to a database rather than a text file. This exercise requires the use of a database development tool such as Microsoft Access.
What will be an ideal response?
```
1 <% @LANGUAGE = VBScript %>
2 <% Option Explicit %>
3
4 <% ' Exercise 25.5 Solution %>
5
6 <%
7 Dim DAconn, insert
8
9 If Request( "entry" ) = "true" Then
10
11 'Create a databse connection and open it.
12 'The database GuestBook must have a registered DSN
13 Set DAconn = Server.CreateObject( "ADODB.Connection")
14 Call DAconn.Open( "GuestBook" )
15
16 On Error Resume Next
17
18 'Build the SQL INSERT string
19
20 insert = "INSERT INTO Guests VALUES ( '" &_
21 CStr( Request( "Name" ) ) & "','" & CStr( Request( "email" ) ) &_
22 "','" & CStr( Request( "Comments" ) ) & "','" & CStr( Date() )& "' )"
23
24 'Execute the insert
25 ' This command wasn't discussed in the book in ch 25.
26 ' It can be used to execute UPDATE commands as well
27 Call DAConn.Execute( insert )
28 Call DAconn.Close()
29 End If
30 %>
31
32
33
34
You might also like to view...
The layer of the IEEE 802 reference model that includes such functions as encoding/decoding of signals and bit transmission/reception is the _________ .
A. physical layer B. control layer C. logical link layer D. media access layer
Which of the following statements about disk fragmentation is FALSE?
A) It decreases the speed of data transfer. B) It can usually be corrected by running a disk defragmentation program. C) It is a problem caused by the disk hardware. D) Data files are stored in pieces instead of together.
A resident virus is a virus that ________.
a) infects a system and spreads over a network to other systems. b) infects the boot sector of a computer’s hard disk. c) enters a system hidden within a legitimate application. d) that operates until the computer is powered down.
The str_word_count() function returns the number of digits in a string.
Answer the following statement true (T) or false (F)