Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Here's a working example using Win32::ODBC using a generic SystemDSN called LIMS2. You can read the perldoc (type perldoc Win32::ODBC on your command line) for a further explanation of the functions.
#!/usr/local/bin/perl -w use strict; use Win32::ODBC; use CGI qw/:standard -debug/; my $data = new Win32::ODBC("LIMS2") or die ODBC::Error(); if (!defined($data)) { print "Unable to connect to LIMS DSN!"; exit; } my $IP = "unknown"; if (defined($ENV{'REMOTE_ADDR'})) { $IP = $ENV{'REMOTE_ADDR'}; } my $sug = param('suggestion'); my $sqlstatement = qq(Insert into tblSuggestionBox (suggestion, IPAddr +ess,TimeOfSuggestion) VALUES (\'$sug\',\'$IP\',Now());); print "$sqlstatement\n"; $data->Sql($sqlstatement); if(defined($data->Error())) { print $data->Error(); } $data->Close(); my $data2 = new Win32::ODBC('LIMS2')||die ODBC::Error(); $data2->Sql("Select * from tblSuggestionBox"); print header, start_html, h1('Suggestions'); print "<table border\=\"1\">"; print Tr(td('Suggestion'), td('IPAddress'), td('Timestamp')); while ($data2->FetchRow()) { my %Ihash = $data2->DataHash(); print "<TR><TD width\=\"33%\">$Ihash{'suggestion'}</TD><TD wid +th\=\"33%\">$Ihash{'IPAddress'}</TD><TD width\=\"33%\">$Ihash{'TimeOf +Suggestion'}</TD></TR>\n"; } print "</table>"; print end_html; 1;
For those of you who notice that I used CGI and then manually added table tags, I seemed to have a problem with the way CGI handles manually defined tags on different systems. This method is thus more portable for me.

Celebrate Intellectual Diversity


In reply to Re: What are the steps to put the form data into MS Access using Perl CGI? by InfiniteSilence
in thread What are the steps to put the form data into MS Access using Perl CGI? by fpw138

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2022-12-03 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?