in reply to Database (OLE) Hashrefs ?

This is very basic with minimal error handling to get you going but DBI would be better.
#!c:/perl/bin/perl -w use strict; use Win32::OLE; # Set up a DSN using # Settings->Control Panel->ODBC Data Sources # make a connection # query the database # close the connection my $conn = Win32::OLE->new("ADODB.Connection"); $conn->open("myDSN1"); my $id = "103" ; # test value my $hash_ref = getData($conn,$id); $conn->close; # check the result print $$hash_ref{'username'}." : ".$$hash_ref{'sessionID'}; sub getData { my ($conn,$id) = @_; my %data=(); # return values # prepare the SQL Statement my $sql = qq( SELECT username,sessionID FROM user WHERE id='$id' ); my $rs = $conn->execute($sql); # catch any error if (!$rs) { my $errors = $conn->errors(); print "Errors:\n"; foreach my $error (keys %$errors) { print $error->{Description}, "\n"; } die; } # get the results # use until loop and movenext # if expecting >1 record # and add id into the %data structure #until ($rs->EOF){ for ('username','sessionID'){ $data{$_} = $rs->fields($_)->value, } # $rs->movenext; #} $rs->close; return \%data; }

poj