blackadder-
what was the error message you received?
if you're having trouble coding up it up, here's a shot at it:
sub LookupServerID
{
# get the servername that was passed into the function
my $serverName = shift;
# build the sql to select the server_id
my $sql = "select server_id from server_tbl where server_name = '$
+serverName'"
# execute the sql with the open $perms_db object
if ($perms_db->Sql($sql))
{
# error during sql!
print "Error:" . $perms_db->Error() . "\n";
# return a value anyway and let the caller check for -1
return -1;
}
# process the result set
$perms_db->FetchRow();
# get the first row within the result set
my(%data) = $perms_db->DataHash();
# return the server_id to the caller
return $data{'server_id'};
# PLEASE NOTE: this code does not watch out for the case where th
+e server_name does not exist. you should code for this case.
}
You should really take a look at this page for a good tutorial for Win32::ODBC. There's a couple of examples there from the guys who wrote the module.
OK there champ- take another whack at it.
|