use strict; use OLE; my $Conn; my $RS; $Conn = CreateObject OLE "ADODB.Connection"; #Create a connection for MS-SQL $Conn->Open("DSN=WIN;UID=db;PWD=passwd;"); #Open the ODBC named WIN $RS = $Conn->execute("select user from accounts where user = 'test'"); if (!$RS) { my $Errors = $Conn->Errors(); my $error; foreach $error (keys %$Errors) { print $error->{Description}, "\n"; } } else { print "The username is $RS->Fields(0)->value.\n"; } $Conn->Close;