Modify the program of Exercise 29.12 to query the database and return the results to the client.
What will be an ideal response?
```
1 #!perl
2 # Exercise 29.13 Solution
3 # Program to read url information from a database
4
5 use Win32::ODBC;
6 use CGI qw/:standard/;
7
8 $querystring = "SELECT * FROM URLTABLE";
9 $search = param( "QUERY" );
10 $DSN = "URL";
11
12 print header;
13 print "
14 if ( !( $Data = new Win32::ODBC( $DSN ) ) )
15 {
16 print "Error connecting to $DSN
";
17 print "Error: " . Win32::ODBC::Error() . "
";
18 exit;
19 }
20
21 if ( $Data->Sql( $querystring ) )
22 {
23 print "SQL failed.
";
24 print "Error: " . $Data->Error() . "
";
25 $Data->Close();
26 exit;
27 }
28
29 print "Results
";
30
31 $c = 0;
32
33 while ( $Data->FetchRow() )
34 {
35 undef %Data;
36 %Data = $Data->DataHash();
37 @key_entries = keys( %Data );
38
39 $first_through = 1;
40
41 foreach $key( keys( %Data ) )
42 {
43 if ( $first_through )
44 {
45
Computer Science & Information Technology
You might also like to view...
All of the following are techniques to display open windows EXCEPT ________
A) side by side B) stacked C) cascade D) continuous
Computer Science & Information Technology
Append queries are often used in conjunction with ________ queries to move records from one table to another
Fill in the blank(s) with correct word
Computer Science & Information Technology