2659 Unix iserver10 2008-05-01 03:35:00 /var 0.5 0.43 14.0 Record 2660 2660 Unix iserver10 2008-05-01 03:35:00 /zLab 1.19 0.8 33.0 Record 2661 2661 Unix iserver10 2008-05-01 03:40:00 / 0.91 0.32 65.0 Record 2662 2662 Unix iserver10 2008-05-01 03:40:00 /backupd 2.94 1.83 38.0 Record 2663 2663 Unix iserver10 2008-05-01 03:40:00 /fr_dev1 1.97 0.74 63.0 Record 2664 2664 Unix iserver10 2008-05-01 03:40:00 /fr_dev1 2.5 0.43 83.0 #### Error in SQL query: "select Date_time from Main where Date_Time >= DateAdd("h", -2, '12/05/2008 03:35') "! Error: [-3010] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Too few parame ters. Expected 1." #### $sql = "select Date_time from Main where Date_Time >= DateAdd(\"h\", -2, '1/05/2008 05:35') "; #### # Display a table in a database using PERL ODBC module use Win32::ODBC; $dsn = "testDB"; $table = "Main"; # ====== Check if the database can be opened correctly if (!($db = new Win32::ODBC($dsn))) { print "Error in opening DSN \"$dsn\"!\n"; print "Error: " . Win32::ODBC::Error(). "\n"; exit; } # ====== Select all fields from the given table $sql = "select Date_time from Main where Date_Time >= DateAdd(\"h\", -2, '1/05/2008 05:35') "; # ====== Check if the SQL query is correct if ($db->Sql($sql)) { print "Error in SQL query: \"$sql\"!\n"; print "Error: " . $db->Error() . "\n"; $db->Close(); exit; } # ====== Print field data print "Content-type: text/html\n\n"; print "
\n";
$count = 1;
@FieldNames = $db->FieldNames();
while ($db->FetchRow()) {
	print "Record $count\n";
	%Data = $db->DataHash();
	foreach $x (@FieldNames) {
		#print "$x: $Data{$x}\n";
		print "$Data{$x} ";
	}
	print "\n";
	$count++;
}
$db->Close();