#!/usr/bin/perl use CGI qw/:standard/; use strict; use Win32::ODBC; my $db = new Win32::ODBC("DSN=portal-mk2"); my $DSN = "portal-mk2"; if (!($db = new Win32::ODBC($DSN))){ print "Error connecting to $DSN\n"; print "Error: " . Win32::ODBC::Error() . "\n"; exit; } my $SqlStatement = "SELECT Id, StudFirstName, StudLastName, HomeGroup FROM dbo.StudDetails"; if ($db->Sql($SqlStatement)){ print "SQL failed.\n"; print "Error: " . $db->Error() . "\n"; $db->Close(); exit; }