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...

Oracle, Microsoft Access, and MySQL are all examples of a(n) ____.

A. DBMS B. SQL statement C. 3NF D. word processor

Computer Science & Information Technology

The src in an image tag stands for ________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

A product key is a code supplied with a software license

Indicate whether the statement is true or false

Computer Science & Information Technology

Statements in a sequence structure are performed without any conditions.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology